[libvirt] [PATCH] cgroup.c: avoid unconditional leaks

Eric Blake ebb9 at byu.net
Thu Feb 4 13:14:44 UTC 2010


According to Jim Meyering on 2/4/2010 3:16 AM:
> Here's output from "git format-patch -U19 --stdout -1",
> so you see the context:
>      for (i = 0; i < ARRAY_CARDINALITY(inherit_values) ; i++) {
>          char *value;
> 
>          rc = virCgroupGetValueStr(parent,
>                                    VIR_CGROUP_CONTROLLER_CPUSET,
>                                    inherit_values[i],
>                                    &value);
>          if (rc != 0) {
>              VIR_ERROR("Failed to get %s %d", inherit_values[i], rc);
>              break;
>          }

Is value allocated prior to that break?

> 
>          VIR_DEBUG("Inherit %s = %s", inherit_values[i], value);
> 
>          rc = virCgroupSetValueStr(group,
>                                    VIR_CGROUP_CONTROLLER_CPUSET,
>                                    inherit_values[i],
>                                    value);
> +        VIR_FREE(value);

Or is it only allocated by virCgroupSetValueStr.

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9 at byu.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 320 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100204/e3aaf528/attachment-0001.sig>


More information about the libvir-list mailing list