From f6d1af1c079f195cc54bf1a188d55dded6d2c910 Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Wed, 17 Feb 2021 12:30:29 +0200 Subject: [PATCH] solve valgrind warning in child_info (#8505) Valgrind warns about `write` accessing uninitialized memory, which was the struct padding. --- src/childinfo.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/childinfo.c b/src/childinfo.c index d9dd17025..e3f33a96c 100644 --- a/src/childinfo.c +++ b/src/childinfo.c @@ -69,10 +69,11 @@ void closeChildInfoPipe(void) { void sendChildInfoGeneric(childInfoType info_type, size_t keys, double progress, char *pname) { if (server.child_info_pipe[1] == -1) return; - child_info_data data = {.information_type=info_type, - .keys=keys, - .cow=zmalloc_get_private_dirty(-1), - .progress=progress}; + child_info_data data = {0}; /* zero everything, including padding to sattisfy valgrind */ + data.information_type = info_type; + data.keys = keys; + data.cow = zmalloc_get_private_dirty(-1); + data.progress = progress; if (data.cow) { serverLog((info_type == CHILD_INFO_TYPE_CURRENT_INFO) ? LL_VERBOSE : LL_NOTICE,