[PATCH 15/19] storage_conf: Resolve Coverity RESOURCE_LEAK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If there was a failure processing 'authdef' and the code went to cleanup
before the setting to source->auth, then it'd be leaked.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/storage_conf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 5a16767..e72a869 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -661,6 +661,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
         }
 
         source->auth = authdef;
+        authdef = NULL;
     }
 
     source->vendor = virXPathString("string(./vendor/@name)", ctxt);
@@ -673,6 +674,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
     VIR_FREE(port);
     VIR_FREE(nodeset);
     VIR_FREE(adapter_type);
+    virStorageAuthDefFree(authdef);
     return ret;
 }
 
-- 
1.9.3

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]