From 84ce5761e93a63cdde3a7b6a86eea8c92e151972 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 12 Sep 2011 15:40:24 +0200 Subject: [PATCH] kill: potential null derefence [smatch scan] Signed-off-by: Karel Zak --- misc-utils/procs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; } /* -- 2.47.3