From 2c591a5e97ad9f354844d3d2b04a4190f9c6fc1f Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 29 May 2022 20:26:30 +0200 Subject: fix memory leak and print sim info over stderr --- shared/bin.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shared/bin.h') diff --git a/shared/bin.h b/shared/bin.h index 1eaa2a7..a849d53 100644 --- a/shared/bin.h +++ b/shared/bin.h @@ -17,7 +17,8 @@ extern uint8_t g_w2_endianness; #define W2_CREATE_MSG_BIN(type, normal, bin) \ W2_CREATE_MSG_SIZE_BIN(type, sizeof(type), normal, bin) #define W2_CREATE_MSG_SIZE_BIN(type, size, normal, bin) \ - w2_s_bin* bin = malloc(size); \ + w2_s_bin* bin = malloc(sizeof(w2_s_bin) + size); \ + bin->bytes = size; \ type* normal = (type*) &bin->data; typedef struct { -- cgit v1.2.3