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

[libvirt] [PATCH 15/19] storage_conf: Resolve Coverity RESOURCE_LEAK



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 redhat com>
---
 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


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