]> granicus.if.org Git - procps-ng/commitdiff
ps: ensuring procps_meminfo_new success, <MEMINFO> api
authorJim Warner <james.warner@comcast.net>
Wed, 11 May 2016 21:16:16 +0000 (16:16 -0500)
committerCraig Small <csmall@dropbear.xyz>
Thu, 12 May 2016 11:13:47 +0000 (21:13 +1000)
The 'new' function requires a NULL context pointer, so
when existing code worked, it was just a case of luck.

Signed-off-by: Jim Warner <james.warner@comcast.net>
ps/output.c

index 5bc93f8ab24e1c1eee2d5d9f67a3cd1db7766088..f7ac3ceeb11062769ed102779aeb03572ce4f42e 100644 (file)
@@ -100,7 +100,7 @@ static void get_boot_time(void)
 
 static void get_memory_total()
 {
-    struct procps_meminfo *mem_info;
+    struct procps_meminfo *mem_info = NULL;
     if (procps_meminfo_new(&mem_info) < 0)
        xerrx(EXIT_FAILURE,
                _("Unable to create meminfo structure"));