Browse Source

HPCC-7991 Avoid uninitialized valgrind warning

A raw (unpacked) struct that was serialized to between slave
and master, caused valgrind warnings regarding uninitialized
data, because of the uninitialized padding between fields
Avoid warning, by memsetting to empty.

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 12 years ago
parent
commit
59271792aa
1 changed files with 2 additions and 0 deletions
  1. 2 0
      thorlcr/slave/slwatchdog.cpp

+ 2 - 0
thorlcr/slave/slwatchdog.cpp

@@ -40,6 +40,8 @@ class CGraphProgressHandlerBase : public CSimpleInterface, implements ISlaveWatc
     {
         MemoryBuffer sendMb, progressMb;
         HeartBeatPacketHeader hb;
+        //clear struct, to avoid spurious warnings when serializing raw [unpacked] struct
+        memset(&hb, 0, sizeof(HeartBeatPacketHeader));
         hb.sender = self;
         hb.tick++;
         size32_t progressSizePos = (byte *)&hb.progressSize - (byte *)&hb;