From: Karel Zak Date: Mon, 12 Sep 2011 13:40:24 +0000 (+0200) Subject: kill: potential null derefence [smatch scan] X-Git-Tag: v2.21-rc1~418 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=84ce5761e93a63cdde3a7b6a86eea8c92e151972;p=thirdparty%2Futil-linux.git kill: potential null derefence [smatch scan] Signed-off-by: Karel Zak --- diff --git a/misc-utils/procs.c b/misc-utils/procs.c index 7bbe02fe11..b09d538a9c 100644 --- a/misc-utils/procs.c +++ b/misc-utils/procs.c @@ -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; } /*