Hello,

On 2011-07-31 23:21, andrei karas wrote:
> This patch fix crash for me.

Sorry, I missed your last mail as it went to my spam folder. Somewhy
your bug mails do not get threaded, did you use the 'reply' button for
subsequent mails? If not, please do.

The patch's idea looks good, but I think your patch introduces a memory
leak. How about the slight modification (attached). Could you please
confirm that it works for you as well?

-- 
Eugene V. Lyubimkin aka JackYF, JID: jackyf.devel(maildog)gmail.com
C++/Perl developer, Debian Developer
diff --git a/ProcessList.c b/ProcessList.c
index c234357..3bb1b81 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -473,7 +473,12 @@ static void ProcessList_readCGroupFile(Process* process, const char* dirname, co
       char** fields = String_split(trimmed, ':');
       free(trimmed);
 
-      process->cgroup = strndup(fields[2] + 1, 10);
+      if (!fields[1] || !fields[2]) {
+         process->cgroup = strdup(""); // cgroups do not work
+      }
+      else {
+         process->cgroup = strndup(fields[2] + 1, 10);
+      }
       String_freeArray(fields);
    }
    fclose(file);

Reply via email to