提交 18e0cc7f 编写于 作者: J Jim Meyering

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):
上级 b39ea452
...@@ -517,8 +517,8 @@ virStoragePoolDefParseSourceString(const char *srcSpec, ...@@ -517,8 +517,8 @@ virStoragePoolDefParseSourceString(const char *srcSpec,
ret = def; ret = def;
def = NULL; def = NULL;
cleanup: cleanup:
if (def) virStoragePoolSourceFree(def);
virStoragePoolSourceFree(def); VIR_FREE(def);
xmlFreeDoc(doc); xmlFreeDoc(doc);
xmlXPathFreeContext(xpath_ctxt); xmlXPathFreeContext(xpath_ctxt);
......
...@@ -172,8 +172,8 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTR ...@@ -172,8 +172,8 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTR
src = NULL; src = NULL;
ret = 0; ret = 0;
cleanup: cleanup:
if (src) virStoragePoolSourceFree(src);
virStoragePoolSourceFree(src); VIR_FREE(src);
return ret; return ret;
} }
...@@ -234,8 +234,8 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE ...@@ -234,8 +234,8 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE
for (i = 0; i < state.list.nsources; i++) for (i = 0; i < state.list.nsources; i++)
virStoragePoolSourceFree(&state.list.sources[i]); virStoragePoolSourceFree(&state.list.sources[i]);
if (source) virStoragePoolSourceFree(source);
virStoragePoolSourceFree(source); VIR_FREE(source);
VIR_FREE(state.list.sources); VIR_FREE(state.list.sources);
......
/* /*
* test.c: A "mock" hypervisor for use by application unit tests * 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 * Copyright (C) 2006 Daniel P. Berrange
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -3766,6 +3766,7 @@ testStorageFindPoolSources(virConnectPtr conn, ...@@ -3766,6 +3766,7 @@ testStorageFindPoolSources(virConnectPtr conn,
cleanup: cleanup:
virStoragePoolSourceFree(source); virStoragePoolSourceFree(source);
VIR_FREE(source);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册