[libvirt] [PATCH 2/3] xenMakeIPList: Don't leak @address_array

John Ferlan jferlan at redhat.com
Tue Dec 12 14:31:10 UTC 2017



On 12/12/2017 09:10 AM, Michal Privoznik wrote:
> ==32171== 32 bytes in 1 blocks are definitely lost in loss record 44 of 107
> ==32171==    at 0x4C2DEF6: calloc (vg_replace_malloc.c:711)
> ==32171==    by 0x55744A9: virAllocN (viralloc.c:191)
> ==32171==    by 0x12CED2: xenMakeIPList (xen_common.c:1186)
> ==32171==    by 0x12D0BE: xenFormatNet (xen_common.c:1221)
> ==32171==    by 0x12F0D2: xenFormatVif (xen_common.c:1889)
> ==32171==    by 0x12F2B4: xenFormatConfigCommon (xen_common.c:1944)
> ==32171==    by 0x13BA32: xenFormatXL (xen_xl.c:1971)
> ==32171==    by 0x1186CA: testCompareParseXML (xlconfigtest.c:105)
> ==32171==    by 0x118A64: testCompareHelper (xlconfigtest.c:205)
> ==32171==    by 0x119E36: virTestRun (testutils.c:180)
> ==32171==    by 0x11970E: mymain (xlconfigtest.c:301)
> ==32171==    by 0x11BEE3: virTestMain (testutils.c:1119)
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/xenconfig/xen_common.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
> index 40b148321..a815b3e0a 100644
> --- a/src/xenconfig/xen_common.c
> +++ b/src/xenconfig/xen_common.c
> @@ -1198,6 +1198,7 @@ xenMakeIPList(virNetDevIPInfoPtr guestIP)
>   cleanup:
>      while (i > 0)
>          VIR_FREE(address_array[--i]);
> +    VIR_FREE(address_array);

How about virStringListFree instead, see:

https://www.redhat.com/archives/libvir-list/2017-December/msg00349.html

Reviewed-by: John Ferlan <jferlan at redhat.com>

John

>      return ret;
>  }
>  
> 




More information about the libvir-list mailing list