[libvirt] [PATCH 1/3] virDomainDefParseXML: Free @tmp when parsing genid

Michal Privoznik posted 3 patches 6 years, 11 months ago
[libvirt] [PATCH 1/3] virDomainDefParseXML: Free @tmp when parsing genid
Posted by Michal Privoznik 6 years, 11 months ago
We need to free return value of virXPathString().

==12962== 37 bytes in 1 blocks are definitely lost in loss record 156 of 331
==12962==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
==12962==    by 0x91E8439: strdup (in /lib64/libc-2.25.so)
==12962==    by 0x5DBD551: virStrdup (virstring.c:977)
==12962==    by 0x5DD3E5E: virXPathString (virxml.c:84)
==12962==    by 0x5E178AB: virDomainDefParseXML (domain_conf.c:19110)
==12962==    by 0x5E1E985: virDomainDefParseNode (domain_conf.c:20885)
==12962==    by 0x5E1E7CB: virDomainDefParse (domain_conf.c:20827)
==12962==    by 0x5E1E871: virDomainDefParseFile (domain_conf.c:20853)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/conf/domain_conf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 27e2bd50eb..d8b4fbd6b0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19120,6 +19120,7 @@ virDomainDefParseXML(xmlDocPtr xml,
                                "%s", _("malformed genid element"));
                 goto error;
             }
+            VIR_FREE(tmp);
         }
     }
     VIR_FREE(nodes);
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] virDomainDefParseXML: Free @tmp when parsing genid
Posted by Peter Krempa 6 years, 11 months ago
On Wed, May 30, 2018 at 18:04:27 +0200, Michal Privoznik wrote:
> We need to free return value of virXPathString().
> 
> ==12962== 37 bytes in 1 blocks are definitely lost in loss record 156 of 331
> ==12962==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
> ==12962==    by 0x91E8439: strdup (in /lib64/libc-2.25.so)
> ==12962==    by 0x5DBD551: virStrdup (virstring.c:977)
> ==12962==    by 0x5DD3E5E: virXPathString (virxml.c:84)
> ==12962==    by 0x5E178AB: virDomainDefParseXML (domain_conf.c:19110)
> ==12962==    by 0x5E1E985: virDomainDefParseNode (domain_conf.c:20885)
> ==12962==    by 0x5E1E7CB: virDomainDefParse (domain_conf.c:20827)
> ==12962==    by 0x5E1E871: virDomainDefParseFile (domain_conf.c:20853)
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/conf/domain_conf.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 27e2bd50eb..d8b4fbd6b0 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -19120,6 +19120,7 @@ virDomainDefParseXML(xmlDocPtr xml,
>                                 "%s", _("malformed genid element"));
>                  goto error;
>              }
> +            VIR_FREE(tmp);


ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] virDomainDefParseXML: Free @tmp when parsing genid
Posted by Michal Privoznik 6 years, 11 months ago
On 05/30/2018 06:46 PM, Peter Krempa wrote:
> On Wed, May 30, 2018 at 18:04:27 +0200, Michal Privoznik wrote:
>> We need to free return value of virXPathString().
>>
>> ==12962== 37 bytes in 1 blocks are definitely lost in loss record 156 of 331
>> ==12962==    at 0x4C2AF0F: malloc (vg_replace_malloc.c:299)
>> ==12962==    by 0x91E8439: strdup (in /lib64/libc-2.25.so)
>> ==12962==    by 0x5DBD551: virStrdup (virstring.c:977)
>> ==12962==    by 0x5DD3E5E: virXPathString (virxml.c:84)
>> ==12962==    by 0x5E178AB: virDomainDefParseXML (domain_conf.c:19110)
>> ==12962==    by 0x5E1E985: virDomainDefParseNode (domain_conf.c:20885)
>> ==12962==    by 0x5E1E7CB: virDomainDefParse (domain_conf.c:20827)
>> ==12962==    by 0x5E1E871: virDomainDefParseFile (domain_conf.c:20853)
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>> ---
>>  src/conf/domain_conf.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index 27e2bd50eb..d8b4fbd6b0 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -19120,6 +19120,7 @@ virDomainDefParseXML(xmlDocPtr xml,
>>                                 "%s", _("malformed genid element"));
>>                  goto error;
>>              }
>> +            VIR_FREE(tmp);
> 
> 
> ACK
> 

And safe for freeze? ;-) This one fixes a feature that was introduced in
this release. The rest of the patches can go after the release.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/3] virDomainDefParseXML: Free @tmp when parsing genid
Posted by Peter Krempa 6 years, 11 months ago
On Thu, May 31, 2018 at 09:16:10 +0200, Michal Privoznik wrote:
> On 05/30/2018 06:46 PM, Peter Krempa wrote:
> > On Wed, May 30, 2018 at 18:04:27 +0200, Michal Privoznik wrote:

[...]

> >> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> >> index 27e2bd50eb..d8b4fbd6b0 100644
> >> --- a/src/conf/domain_conf.c
> >> +++ b/src/conf/domain_conf.c
> >> @@ -19120,6 +19120,7 @@ virDomainDefParseXML(xmlDocPtr xml,
> >>                                 "%s", _("malformed genid element"));
> >>                  goto error;
> >>              }
> >> +            VIR_FREE(tmp);
> > 
> > 
> > ACK
> > 
> 
> And safe for freeze? ;-) This one fixes a feature that was introduced in
> this release. The rest of the patches can go after the release.

Yes. I thought it was obvious :)

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