On 07/12/2011 10:30 AM, Peter Schiffer wrote: > In function cgroup_parse_rules() added missing check for getpwuid() result. > In cgroup_get_procs() added missing fclose() on file descriptor. > In load_list() added missing fclose() on file descriptor. > > Signed-off-by: Peter Schiffer <pschi...@redhat.com> Acked-By: Jan Safranek <jsafr...@redhat.com>
But please send separate patches next time, even for such simple fixes. > --- > > src/api.c | 5 +++++ > src/tools/cgsnapshot.c | 2 ++ > 2 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/src/api.c b/src/api.c > index d5022c2..e443ad5 100644 > --- a/src/api.c > +++ b/src/api.c > @@ -637,6 +637,9 @@ static int cgroup_parse_rules(bool cache, uid_t muid, > */ > if (grp && muid != CGRULE_INVALID) { > pwd = getpwuid(muid); > + if (!pwd) { > + continue; > + } > for (i = 0; grp->gr_mem[i]; i++) { > if (!(strcmp(pwd->pw_name, grp->gr_mem[i]))) > matched = true; > @@ -3910,6 +3913,8 @@ int cgroup_get_procs(char *name, char *controller, > pid_t **pids, int *size) > } > } > > + fclose(procs); > + > *size = n; > > qsort(tmp_list, n, sizeof(pid_t), &pid_compare); > diff --git a/src/tools/cgsnapshot.c b/src/tools/cgsnapshot.c > index 30e7b6d..404d54a 100644 > --- a/src/tools/cgsnapshot.c > +++ b/src/tools/cgsnapshot.c > @@ -146,6 +146,8 @@ int load_list(char *filename, struct black_list_type > **p_list) > } > } > > + fclose(fw); > + > *p_list = start; > return 0; > > > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > Libcg-devel mailing list > Libcg-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libcg-devel ------------------------------------------------------------------------------ AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel