From c1007f50de3ad7284d4a1afa6bfb3b6e427c3556 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Tue, 18 Jun 2024 16:11:57 +0200 Subject: stupid dumb bug --- lib/pbdrv/pb-msg.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/pbdrv/pb-msg.c b/lib/pbdrv/pb-msg.c index 8cf020c..1d7f90b 100644 --- a/lib/pbdrv/pb-msg.c +++ b/lib/pbdrv/pb-msg.c @@ -11,6 +11,7 @@ pb_buf_t pb_msg_write(const pb_msg_t * msg) { buf.data = pb_malloc(MPACK_BUFFER_SIZE); if (buf.data == NULL) return buf; + buf.size = MPACK_BUFFER_SIZE; mpack_writer_t writer; mpack_writer_init(&writer, buf.data, buf.size); @@ -18,11 +19,7 @@ pb_buf_t pb_msg_write(const pb_msg_t * msg) { pb_ser_w(&writer, msg); buf.size = mpack_writer_buffer_used(&writer); - if (mpack_writer_destroy(&writer) != mpack_ok) { - pb_free(buf.data); - buf.data = NULL; - buf.size = 0; - } + mpack_writer_destroy(&writer); return buf; } -- cgit v1.2.3