diff options
author | Karel Zak | 2011-09-12 15:40:24 +0200 |
---|---|---|
committer | Karel Zak | 2011-09-12 15:40:24 +0200 |
commit | 84ce5761e93a63cdde3a7b6a86eea8c92e151972 (patch) | |
tree | 89934dc9d7b30051d0c61095c7fc4cd0e1d72ffe /misc-utils | |
parent | libmount: potential null derefence [smatch scan] (diff) | |
download | kernel-qcow2-util-linux-84ce5761e93a63cdde3a7b6a86eea8c92e151972.tar.gz kernel-qcow2-util-linux-84ce5761e93a63cdde3a7b6a86eea8c92e151972.tar.xz kernel-qcow2-util-linux-84ce5761e93a63cdde3a7b6a86eea8c92e151972.zip |
kill: potential null derefence [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils')
-rw-r--r-- | misc-utils/procs.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/misc-utils/procs.c b/misc-utils/procs.c index 7bbe02fe1..b09d538a9 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; } /* |