[PATCH 2/3] virDomainNetDefClear: Free @persistent name

Michal Privoznik posted 3 patches 5 years, 11 months ago
There is a newer version of this series
[PATCH 2/3] virDomainNetDefClear: Free @persistent name
Posted by Michal Privoznik 5 years, 11 months ago
The persistent alias name @persistent is allocated in
virDomainNetDefParseXML() but never freed.

==119642== 22 bytes in 2 blocks are definitely lost in loss record 178 of 671
==119642==    at 0x483579F: malloc (vg_replace_malloc.c:309)
==119642==    by 0x58F89F1: xmlStrndup (in /usr/lib64/libxml2.so.2.9.9)
==119642==    by 0x4BA3B74: virXMLPropString (virxml.c:520)
==119642==    by 0x4BDB0C5: virDomainNetDefParseXML (domain_conf.c:11876)
==119642==    by 0x4BF9EF4: virDomainDefParseXML (domain_conf.c:21196)
==119642==    by 0x4BFCD5B: virDomainDefParseNode (domain_conf.c:21943)
==119642==    by 0x4BFCC36: virDomainDefParse (domain_conf.c:21901)
==119642==    by 0x4BFCCCB: virDomainDefParseFile (domain_conf.c:21924)
==119642==    by 0x114A9D: testCompareXMLToArgv (qemuxml2argvtest.c:452)
==119642==    by 0x13894F: virTestRun (testutils.c:143)
==119642==    by 0x11F46E: mymain (qemuxml2argvtest.c:1316)
==119642==    by 0x13A60E: virTestMain (testutils.c:839

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 bd2ca53f1d..cef49df3f8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2444,6 +2444,7 @@ virDomainNetDefClear(virDomainNetDefPtr def)
 
     VIR_FREE(def->backend.tap);
     VIR_FREE(def->backend.vhost);
+    VIR_FREE(def->teaming.persistent);
     VIR_FREE(def->virtPortProfile);
     VIR_FREE(def->script);
     VIR_FREE(def->domain_name);
-- 
2.24.1

Re: [PATCH 2/3] virDomainNetDefClear: Free @persistent name
Posted by Ján Tomko 5 years, 11 months ago
On Fri, Feb 21, 2020 at 08:44:50AM +0100, Michal Privoznik wrote:
>The persistent alias name @persistent is allocated in
>virDomainNetDefParseXML() but never freed.
>
>==119642== 22 bytes in 2 blocks are definitely lost in loss record 178 of 671
>==119642==    at 0x483579F: malloc (vg_replace_malloc.c:309)
>==119642==    by 0x58F89F1: xmlStrndup (in /usr/lib64/libxml2.so.2.9.9)
>==119642==    by 0x4BA3B74: virXMLPropString (virxml.c:520)
>==119642==    by 0x4BDB0C5: virDomainNetDefParseXML (domain_conf.c:11876)
>==119642==    by 0x4BF9EF4: virDomainDefParseXML (domain_conf.c:21196)
>==119642==    by 0x4BFCD5B: virDomainDefParseNode (domain_conf.c:21943)
>==119642==    by 0x4BFCC36: virDomainDefParse (domain_conf.c:21901)
>==119642==    by 0x4BFCCCB: virDomainDefParseFile (domain_conf.c:21924)
>==119642==    by 0x114A9D: testCompareXMLToArgv (qemuxml2argvtest.c:452)
>==119642==    by 0x13894F: virTestRun (testutils.c:143)
>==119642==    by 0x11F46E: mymain (qemuxml2argvtest.c:1316)
>==119642==    by 0x13A60E: virTestMain (testutils.c:839
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/conf/domain_conf.c | 1 +
> 1 file changed, 1 insertion(+)
>

Fixes: fb0509d06ac57434c2edbd81ee63deb32a0e598a
Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano