X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmemory.c;h=6204d35ce8cf239113abda6059e5fba0287d0142;hb=9521a596cb88b044a2f08db53520edd6e15c8d39;hp=3d8a867a7463c9eab4329d8af34caa1764b8dac5;hpb=5047407e6c0ca8b53bf1629144396702cd18cf08;p=collectd.git diff --git a/src/memory.c b/src/memory.c index 3d8a867a..6204d35c 100644 --- a/src/memory.c +++ b/src/memory.c @@ -24,6 +24,7 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" @@ -456,13 +457,12 @@ static int memory_read_internal (value_list_t *vl) #elif HAVE_SYSCTL int mib[] = {CTL_VM, VM_METER}; - struct vmtotal vmtotal; + struct vmtotal vmtotal = { 0 }; gauge_t mem_active; gauge_t mem_inactive; gauge_t mem_free; size_t size; - memset (&vmtotal, 0, sizeof (vmtotal)); size = sizeof (vmtotal); if (sysctl (mib, 2, &vmtotal, &size, NULL, 0) < 0) { @@ -495,9 +495,8 @@ static int memory_read_internal (value_list_t *vl) /* #endif HAVE_LIBSTATGRAB */ #elif HAVE_PERFSTAT - perfstat_memory_total_t pmemory; + perfstat_memory_total_t pmemory = { 0 }; - memset (&pmemory, 0, sizeof (pmemory)); if (perfstat_memory_total(NULL, &pmemory, sizeof(pmemory), 1) < 0) { char errbuf[1024];