X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fmemory.c;h=744af1a8e7999b51706395889e451f6a740b39b0;hb=dc6f54ccc87c5ae63d29f05eca91714ade689691;hp=ea16ce315f102126d7ca0f497ea8d153fb6c2339;hpb=6164fe4456716e6dc36aaa2ab617b104a7ac5ff3;p=collectd.git diff --git a/src/memory.c b/src/memory.c index ea16ce31..744af1a8 100644 --- a/src/memory.c +++ b/src/memory.c @@ -237,7 +237,7 @@ static int memory_read_internal (value_list_t *vl) * vm.stats.vm.v_inactive_count: 113730 * vm.stats.vm.v_cache_count: 10809 */ - char *sysctl_keys[8] = + const char *sysctl_keys[8] = { "vm.stats.vm.v_page_size", "vm.stats.vm.v_page_count", @@ -456,13 +456,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 +494,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];