Re: [libvirt] [PATCH] vbox_tmpl.c: avoid leak on OOM error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/2/15 Jim Meyering <jim@xxxxxxxxxxxx>:
> Matthias Bolte wrote:
> ...
>>>  cleanup:
>>> +    VIR_FREE(def);
>>
>> No, a simple VIR_FREE isn't enough here. At this point def can
>> contains allocated parts. It's necessary to call
>> virNetworkDefFree(def) here. virNetworkDefFree takes care of freeing
>> all parts of def and def itself.
>
> Well, that's obviously what I meant ;-)
> Need to re-tune this AI that's mangling my patches.
>
> From 2e7a52d3832952f6757d8f9ddfc92f497d10c2a9 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering@xxxxxxxxxx>
> Date: Mon, 15 Feb 2010 17:54:15 +0100
> Subject: [PATCH] vbox_tmpl.c: avoid an unconditional leak
>
> * src/vbox/vbox_tmpl.c (vboxDomainDumpXML): Free def.
> Improved by Matthias Bolte.
> ---
>  src/vbox/vbox_tmpl.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
> index 68dffd2..d1a701e 100644
> --- a/src/vbox/vbox_tmpl.c
> +++ b/src/vbox/vbox_tmpl.c
> @@ -6183,6 +6183,7 @@ static char *vboxNetworkDumpXML(virNetworkPtr network, int flags ATTRIBUTE_UNUSE
>     ret = virNetworkDefFormat(def);
>
>  cleanup:
> +    virNetworkDefFree(def);
>     VIR_FREE(networkNameUtf8);
>     return ret;
>  }
> --
> 1.7.0.181.g41533
>

ACK

Matthias

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]