From: Jim Warner Date: Thu, 6 Oct 2011 13:34:26 +0000 (-0500) Subject: redhat analysis: proc/readproc X-Git-Tag: v3.3.0~7^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4820619f15b02c6f40b8421e519af5ddcba624bc;p=procps-ng redhat analysis: proc/readproc --- diff --git a/proc/readproc.c b/proc/readproc.c index 4949704e..45ec4150 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -1112,15 +1112,13 @@ next_proc: } next_task: - for (;;) { - // fills in our path, plus x->tid and x->tgid - if ((!(PT->taskfinder(PT,&skel_p,x,path))) // simple_nexttid - || (!(ret = PT->taskreader(PT,new_p,x,path)))) { // simple_readtask - goto next_proc; - } - if (!new_p) new_p = ret; - return ret; + // fills in our path, plus x->tid and x->tgid + if ((!(PT->taskfinder(PT,&skel_p,x,path))) // simple_nexttid + || (!(ret = PT->taskreader(PT,new_p,x,path)))) { // simple_readtask + goto next_proc; } + if (!new_p) new_p = ret; + return ret; end_procs: if (!saved_x) free(x); @@ -1152,7 +1150,7 @@ PROCTAB* openproc(int flags, ...) { PT->finder = listed_nextpid; }else{ PT->procfs = opendir("/proc"); - if(!PT->procfs) return NULL; + if(!PT->procfs) { free(PT); return NULL; } PT->finder = simple_nextpid; } PT->flags = flags;