plug four virStoragePoolSourceFree-related leaks

* src/conf/storage_conf.c (virStoragePoolDefParseSourceString):
* src/storage/storage_backend_fs.c:
(virStorageBackendFileSystemNetFindPoolSourcesFunc):
(virStorageBackendFileSystemNetFindPoolSources):
* src/test/test_driver.c (testStorageFindPoolSources):
This commit is contained in:
Jim Meyering 2010-02-05 17:09:43 +01:00
parent b39ea45292
commit 18e0cc7f72
3 changed files with 8 additions and 7 deletions

View 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);

View 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);

View 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;
}