On 04/24/2011 05:48 AM, Matthias Bolte wrote:
Suggested by Daniel P. Berrange
---
src/conf/nwfilter_conf.c | 5 +----
src/conf/storage_conf.c | 7 +------
src/util/util.c | 2 ++
src/xen/xen_inotify.c | 1 -
src/xen/xm_internal.c | 5 +----
5 files changed, 5 insertions(+), 15 deletions(-)
ACK.
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 327fab3..09dc32b 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2588,10 +2588,8 @@ virNWFilterLoadAllConfigs(virConnectPtr conn,
if (!virFileHasSuffix(entry->d_name, ".xml"))
continue;
- if (!(path = virFileBuildPath(configDir, entry->d_name, NULL))) {
- virReportOOMError();
+ if (!(path = virFileBuildPath(configDir, entry->d_name, NULL)))
continue;
- }
nwfilter = virNWFilterObjLoad(conn, nwfilters, entry->d_name, path);
if (nwfilter)
@@ -2627,7 +2625,6 @@ virNWFilterObjSaveDef(virNWFilterDriverStatePtr driver,
if (!(nwfilter->configFile = virFileBuildPath(driver->configDir,
def->name, ".xml")))
{
- virReportOOMError();
return -1;
}
}
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 5a069f5..116898d 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1483,14 +1483,11 @@ virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
if (!virFileHasSuffix(entry->d_name, ".xml"))
continue;
- if (!(path = virFileBuildPath(configDir, entry->d_name, NULL))) {
- virReportOOMError();
+ if (!(path = virFileBuildPath(configDir, entry->d_name, NULL)))
continue;
- }
if (!(autostartLink = virFileBuildPath(autostartDir, entry->d_name,
NULL))) {
- virReportOOMError();
VIR_FREE(path);
continue;
}
@@ -1529,13 +1526,11 @@ virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
if (!(pool->configFile = virFileBuildPath(driver->configDir,
def->name, ".xml"))) {
- virReportOOMError();
return -1;
}
if (!(pool->autostartLink = virFileBuildPath(driver->autostartDir,
def->name, ".xml")))
{
- virReportOOMError();
VIR_FREE(pool->configFile);
return -1;
}
diff --git a/src/util/util.c b/src/util/util.c
index d4d2610..3948b01 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -1851,10 +1851,12 @@ virFileBuildPath(const char *dir, const char *name, const char
*ext)
if (ext == NULL) {
if (virAsprintf(&path, "%s/%s", dir, name)< 0) {
+ virReportOOMError();
return NULL;
}
} else {
if (virAsprintf(&path, "%s/%s%s", dir, name, ext)< 0) {
+ virReportOOMError();
return NULL;
}
}
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index d809c45..9dde72c 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -415,7 +415,6 @@ xenInotifyOpen(virConnectPtr conn,
/* Build the full file path */
if (!(path = virFileBuildPath(priv->configDir, ent->d_name, NULL)))
{
- virReportOOMError();
closedir(dh);
return -1;
}
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index db47a02..f9f52b5 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -388,7 +388,6 @@ int xenXMConfigCacheRefresh (virConnectPtr conn) {
/* Build the full file path */
if (!(path = virFileBuildPath(priv->configDir, ent->d_name, NULL))) {
- virReportOOMError();
closedir(dh);
return -1;
}
@@ -1134,10 +1133,8 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char
*xml)
entry = NULL;
}
- if (!(filename = virFileBuildPath(priv->configDir, def->name, NULL))) {
- virReportOOMError();
+ if (!(filename = virFileBuildPath(priv->configDir, def->name, NULL)))
goto error;
- }
if (xenXMConfigSaveFile(conn, filename, def)< 0)
goto error;