]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
plug four virStoragePoolSourceFree-related leaks
authorJim Meyering <meyering@redhat.com>
Fri, 5 Feb 2010 16:09:43 +0000 (17:09 +0100)
committerJim Meyering <meyering@redhat.com>
Thu, 11 Feb 2010 16:22:45 +0000 (17:22 +0100)
* src/conf/storage_conf.c (virStoragePoolDefParseSourceString):
* src/storage/storage_backend_fs.c:
(virStorageBackendFileSystemNetFindPoolSourcesFunc):
(virStorageBackendFileSystemNetFindPoolSources):
* src/test/test_driver.c (testStorageFindPoolSources):

src/conf/storage_conf.c
src/storage/storage_backend_fs.c
src/test/test_driver.c

index 23526371d508f1b3d9f93cac431411d50a2b76ea..eefa55f11d03576be62d65b185d7b2dd46b9c2e9 100644 (file)
@@ -517,8 +517,8 @@ virStoragePoolDefParseSourceString(const char *srcSpec,
     ret = def;
     def = NULL;
 cleanup:
-    if (def)
-        virStoragePoolSourceFree(def);
+    virStoragePoolSourceFree(def);
+    VIR_FREE(def);
     xmlFreeDoc(doc);
     xmlXPathFreeContext(xpath_ctxt);
 
index 03ba43a449596e904136cc026f1f4c775cf6d63a..bbd5787a10333787fe8633d60c390a3d20019179 100644 (file)
@@ -172,8 +172,8 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTR
     src = NULL;
     ret = 0;
 cleanup:
-    if (src)
-        virStoragePoolSourceFree(src);
+    virStoragePoolSourceFree(src);
+    VIR_FREE(src);
     return ret;
 }
 
@@ -234,8 +234,8 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE
     for (i = 0; i < state.list.nsources; i++)
         virStoragePoolSourceFree(&state.list.sources[i]);
 
-    if (source)
-        virStoragePoolSourceFree(source);
+    virStoragePoolSourceFree(source);
+    VIR_FREE(source);
 
     VIR_FREE(state.list.sources);
 
index a17217a6d98a296ca290ec4758cbca242db6dd6f..d552f032b7d0e522edccc4a4b7a1872ed94411be 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * test.c: A "mock" hypervisor for use by application unit tests
  *
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -3766,6 +3766,7 @@ testStorageFindPoolSources(virConnectPtr conn,
 
 cleanup:
     virStoragePoolSourceFree(source);
+    VIR_FREE(source);
     return ret;
 }