From 38d74e8a04e11baf6808642187082d9b01f97b64 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 20 May 2015 20:25:32 +0200 Subject: [PATCH] ctl: don't use C99 designated initializer for structs to travel on a socket While this is harmless, we prefer to know that each byte is correctly initialized to avoid Valgrind warnings. --- src/ctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ctl.c b/src/ctl.c index 5799f1d6..a347908e 100644 --- a/src/ctl.c +++ b/src/ctl.c @@ -160,10 +160,10 @@ ctl_msg_send_unserialized(uint8_t **output_buffer, size_t *output_len, *output_buffer = new; } - struct hmsg_header hdr = { - .type = type, - .len = len - }; + struct hmsg_header hdr; + memset(&hdr, 0, sizeof(struct hmsg_header)); + hdr.type = type; + hdr.len = len; memcpy(*output_buffer + *output_len, &hdr, sizeof(struct hmsg_header)); if (t) memcpy(*output_buffer + *output_len + sizeof(struct hmsg_header), buffer, len); -- 2.39.5