On Mon, Nov 15, 2010 at 4:16 PM, Jan Safranek <[email protected]> wrote: > Fix few memory leaks in cgcreate tools, as pointed out by Steve Grub. > > Signed-off-by: Jan Safranek <[email protected]>
Acked-by: Dhaval Giani <[email protected]> > --- > > src/tools/cgcreate.c | 25 ++++++++++++++++--------- > 1 files changed, 16 insertions(+), 9 deletions(-) > > diff --git a/src/tools/cgcreate.c b/src/tools/cgcreate.c > index 8a728ed..a2a21b2 100644 > --- a/src/tools/cgcreate.c > +++ b/src/tools/cgcreate.c > @@ -138,7 +138,8 @@ int main(int argc, char *argv[]) > cgroup_list = calloc(capacity, sizeof(struct cgroup_group_spec *)); > if (cgroup_list == NULL) { > fprintf(stderr, "%s: out of memory\n", argv[0]); > - return -1; > + ret = -1; > + goto err; > } > > /* parse arguments */ > @@ -147,7 +148,8 @@ int main(int argc, char *argv[]) > switch (c) { > case 'h': > usage(0, argv[0]); > - return 0; > + ret = 0; > + goto err; > case 'a': > /* set admin uid/gid */ > if (optarg[0] == ':') > @@ -166,7 +168,8 @@ int main(int argc, char *argv[]) > fprintf(stderr, "%s: " > "can't find uid of user %s.\n", > argv[0], pwd_string); > - return -1; > + ret = -1; > + goto err; > } > } > if (grp_string != NULL) { > @@ -177,7 +180,8 @@ int main(int argc, char *argv[]) > fprintf(stderr, "%s: " > "can't find gid of group > %s.\n", > argv[0], grp_string); > - return -1; > + ret = -1; > + goto err; > } > } > > @@ -200,7 +204,8 @@ int main(int argc, char *argv[]) > fprintf(stderr, "%s: " > "can't find uid of user %s.\n", > argv[0], pwd_string); > - return -1; > + ret = -1; > + goto err; > } > } > if (grp_string != NULL) { > @@ -211,7 +216,8 @@ int main(int argc, char *argv[]) > fprintf(stderr, "%s: " > "can't find gid of group > %s.\n", > argv[0], grp_string); > - return -1; > + ret = -1; > + goto err; > } > } > break; > @@ -222,7 +228,8 @@ int main(int argc, char *argv[]) > "cgroup controller and path" > "parsing failed (%s)\n", > argv[0], argv[optind]); > - return -1; > + ret = -1; > + goto err; > } > break; > case 'd': > @@ -235,8 +242,8 @@ int main(int argc, char *argv[]) > break; > default: > usage(1, argv[0]); > - return -1; > - break; > + ret = -1; > + goto err; > } > } > > > > ------------------------------------------------------------------------------ > Centralized Desktop Delivery: Dell and VMware Reference Architecture > Simplifying enterprise desktop deployment and management using > Dell EqualLogic storage and VMware View: A highly scalable, end-to-end > client virtualization framework. Read more! > http://p.sf.net/sfu/dell-eql-dev2dev > _______________________________________________ > Libcg-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/libcg-devel > ------------------------------------------------------------------------------ Centralized Desktop Delivery: Dell and VMware Reference Architecture Simplifying enterprise desktop deployment and management using Dell EqualLogic storage and VMware View: A highly scalable, end-to-end client virtualization framework. Read more! http://p.sf.net/sfu/dell-eql-dev2dev _______________________________________________ Libcg-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libcg-devel
