On 11/15/2010 12:54 PM, Dhaval Giani wrote:
> Steve Grubb was kind enough to do a code review at
> http://article.gmane.org/gmane.comp.lib.libcg.devel/2485
> and spotted a few memory leaks. Take care of them!
>
> Reported-by: Steve Grubb<[email protected]>
> Signed-off-by: Dhaval Giani<[email protected]>
Acked-By: Jan Safranek <[email protected]>
> ---
> src/wrapper.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> Index: libcg/src/wrapper.c
> ===================================================================
> --- libcg.orig/src/wrapper.c
> +++ libcg/src/wrapper.c
> @@ -162,8 +162,10 @@ int cgroup_add_value_int64(struct cgroup
> ret = snprintf(cntl_value->value,
> sizeof(cntl_value->value), "%" PRId64, value);
>
> - if (ret>= sizeof(cntl_value->value))
> + if (ret>= sizeof(cntl_value->value)) {
> + free(cntl_value);
> return ECGINVAL;
> + }
>
> controller->values[controller->index] = cntl_value;
> controller->index++;
> @@ -199,8 +201,10 @@ int cgroup_add_value_uint64(struct cgrou
> ret = snprintf(cntl_value->value, sizeof(cntl_value->value),
> "%" PRIu64, value);
>
> - if (ret>= sizeof(cntl_value->value))
> + if (ret>= sizeof(cntl_value->value)) {
> + free(cntl_value);
> return ECGINVAL;
> + }
>
> controller->values[controller->index] = cntl_value;
> controller->index++;
> @@ -241,8 +245,10 @@ int cgroup_add_value_bool(struct cgroup_
> ret = snprintf(cntl_value->value,
> sizeof(cntl_value->value), "0");
>
> - if (ret>= sizeof(cntl_value->value))
> + if (ret>= sizeof(cntl_value->value)) {
> + free(cntl_value);
> return ECGINVAL;
> + }
>
> controller->values[controller->index] = cntl_value;
> controller->index++;
>
>
>
> ------------------------------------------------------------------------------
> 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