summaryrefslogtreecommitdiff
path: root/shared/bin.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-05-29 20:26:30 +0200
committerlonkaars <loek@pipeframe.xyz>2022-05-29 20:26:30 +0200
commit2c591a5e97ad9f354844d3d2b04a4190f9c6fc1f (patch)
tree3593ff0e9bebcf4fbf8cd33160114f13711f093e /shared/bin.h
parent4227c0d62e6df83e96c2b5fa62a8a743d4d96c8f (diff)
fix memory leak and print sim info over stderr
Diffstat (limited to 'shared/bin.h')
-rw-r--r--shared/bin.h3
1 files changed, 2 insertions, 1 deletions
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 {