]> xenbits.xensource.com Git - libvirt.git/commitdiff
virStorageEncryptionSecretFree: Don't leak secret lookup definition
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 8 Jul 2016 16:09:40 +0000 (18:09 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 11 Jul 2016 12:21:01 +0000 (14:21 +0200)
When storage secret is parsed in virStorageEncryptionSecretParse(),
virSecretLookupParseSecret() which allocates some memory. This is
however never freed.

==21711== 134 bytes in 6 blocks are definitely lost in loss record 70 of 85
==21711==    at 0x4C29F80: malloc (vg_replace_malloc.c:296)
==21711==    by 0xBCA0356: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
==21711==    by 0xA9F432E: virXMLPropString (virxml.c:479)
==21711==    by 0xA9D25B0: virSecretLookupParseSecret (virsecret.c:70)
==21711==    by 0xA9D616E: virStorageEncryptionSecretParse (virstorageencryption.c:172)
==21711==    by 0xA9D66B2: virStorageEncryptionParseXML (virstorageencryption.c:281)
==21711==    by 0xA9D68DF: virStorageEncryptionParseNode (virstorageencryption.c:338)
==21711==    by 0xAA12575: virDomainDiskDefParseXML (domain_conf.c:7606)
==21711==    by 0xAA2CAC6: virDomainDefParseXML (domain_conf.c:16658)
==21711==    by 0xAA2FC75: virDomainDefParseNode (domain_conf.c:17472)
==21711==    by 0xAA2FAE4: virDomainDefParse (domain_conf.c:17419)
==21711==    by 0xAA2FB72: virDomainDefParseFile (domain_conf.c:17443)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virstorageencryption.c

index 4dab8bb8991052cd68a0cbf73fc8944decafa117..116a2358ae5c6f399ca250dbff02efd7437b31df 100644 (file)
@@ -62,6 +62,7 @@ virStorageEncryptionSecretFree(virStorageEncryptionSecretPtr secret)
 {
     if (!secret)
         return;
+    virSecretLookupDefClear(&secret->seclookupdef);
     VIR_FREE(secret);
 }