From: Vincent Bernat Date: Wed, 20 May 2015 18:25:32 +0000 (+0200) Subject: ctl: don't use C99 designated initializer for structs to travel on a socket X-Git-Tag: 0.7.15~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38d74e8a04e11baf6808642187082d9b01f97b64;p=thirdparty%2Flldpd.git 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. --- 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);