From: Karel Zak Date: Mon, 12 Sep 2011 13:40:24 +0000 (+0200) Subject: kill: potential null derefence [smatch scan] X-Git-Tag: v2.20.1~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5bc520a5cecf11e7710d74920a0e7c35bcc8f57a;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 3f52387de7..1fafc9bbe4 100644 --- a/misc-utils/procs.c +++ b/misc-utils/procs.c @@ -79,11 +79,13 @@ get_pids (char *process_name, int get_all) { pids_size += 5; pids = (int *) realloc (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; } /*