Explorar o código

Merge pull request #356 from richardkchapman/valgrind

Fix uninitialized variable in cpu usage reporting

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday %!s(int64=13) %!d(string=hai) anos
pai
achega
7ef9ac42fe
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      system/jlib/jdebug.cpp

+ 10 - 0
system/jlib/jdebug.cpp

@@ -1605,8 +1605,18 @@ public:
         kbuf = NULL;
         kbufsz = 0;
         kbufcrc = 0;
+        memset(&oldcpu, 0, sizeof(oldcpu));
+        memset(&newcpu, 0, sizeof(newcpu));
+        memset(&cpu, 0, sizeof(cpu));
+        totalcpu = 0;
+        numcpu = 0;
+        memset(&oldnet, 0, sizeof(oldnet));
+        memset(&newnet, 0, sizeof(newnet));
+        ndisks = 0;
         if (printklog)
             kbufmax = 0x1000;
+        else
+            kbufmax = 0;
     }
 
     ~CExtendedStats()