[libvirt] [PATCH 4/4] storagepoolxml2argvtest: Avoid double free

Michal Privoznik mprivozn at redhat.com
Tue May 14 09:24:12 UTC 2019


A double free may occur in testCompareXMLToArgvFiles() when @def
is freed right after virStoragePoolObjNew() failed and the second
time at cleanup label.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/storagepoolxml2argvtest.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/storagepoolxml2argvtest.c b/tests/storagepoolxml2argvtest.c
index b7e32064af..0c01931946 100644
--- a/tests/storagepoolxml2argvtest.c
+++ b/tests/storagepoolxml2argvtest.c
@@ -39,7 +39,6 @@ testCompareXMLToArgvFiles(bool shouldFail,
     case VIR_STORAGE_POOL_NETFS:
         if (!(pool = virStoragePoolObjNew())) {
             VIR_TEST_DEBUG("pool type '%s' alloc pool obj fails\n", defTypeStr);
-            virStoragePoolDefFree(def);
             goto cleanup;
         }
         virStoragePoolObjSetDef(pool, def);
-- 
2.21.0




More information about the libvir-list mailing list