]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
kill: potential null derefence [smatch scan]
authorKarel Zak <kzak@redhat.com>
Mon, 12 Sep 2011 13:40:24 +0000 (15:40 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 12 Sep 2011 13:40:24 +0000 (15:40 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/procs.c

index 7bbe02fe11df35f46faa2c00fbe6e9afdfe49817..b09d538a9cdd7fd9e69541b11216182e21c8a217 100644 (file)
@@ -80,11 +80,13 @@ get_pids (char *process_name, int get_all) {
            pids_size += 5;
            pids = (int *) xrealloc (pids, sizeof (int) * pids_size);
        }
-       pids[num_pids++] = pid;
-       pids[num_pids] = -1;
+       if (pids) {
+               pids[num_pids++] = pid;
+               pids[num_pids] = -1;
+       }
     }
     closedir (dir);
-    return (pids);
+    return pids;
 }
 
 /*