aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-18 16:11:57 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-18 16:11:57 +0200
commitc1007f50de3ad7284d4a1afa6bfb3b6e427c3556 (patch)
tree37b6d0fca12343640bd497b3ad17c2d69842a529 /lib
parent1e54994000d1c26e9cbd724b76da5ceb273f9cbb (diff)
stupid dumb bug
Diffstat (limited to 'lib')
-rw-r--r--lib/pbdrv/pb-msg.c7
1 files changed, 2 insertions, 5 deletions
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;
}