From: Florian Forster Date: Sun, 26 Aug 2007 17:07:10 +0000 (+0200) Subject: processes plugin: Fix a possible segfault. X-Git-Tag: collectd-4.0.7~3^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d5c752eacdc72545328f1d5153f26ceb5fc6cfc0;p=collectd.git processes plugin: Fix a possible segfault. --- diff --git a/src/processes.c b/src/processes.c index ccf1571f..4b59351c 100644 --- a/src/processes.c +++ b/src/processes.c @@ -642,11 +642,14 @@ static int *ps_read_tasks (int pid) closedir (dh); + if (list_len == 0) + return (NULL); + assert (list_len < list_size); assert (list[list_len] == 0); return (list); -} +} /* int *ps_read_tasks */ int ps_read_process (int pid, procstat_t *ps, char *state) {