aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Bolte <matthias.bolte@googlemail.com>2009-11-08 22:08:54 +0100
committerMatthias Bolte <matthias.bolte@googlemail.com>2009-11-09 23:17:45 +0100
commit790f0b3057787bb64da8c46c111ff8d3eff7b2af (patch)
tree4c2e40e1299b1d4f6e41eae102d153edf5db5fe6 /src/conf/node_device_conf.c
parentAdd documentation for <channel> domain element (diff)
downloadlibvirt-790f0b3057787bb64da8c46c111ff8d3eff7b2af.tar.gz
libvirt-790f0b3057787bb64da8c46c111ff8d3eff7b2af.tar.bz2
libvirt-790f0b3057787bb64da8c46c111ff8d3eff7b2af.zip
Add missing OOM error checks, reports and cleanups
Diffstat (limited to 'src/conf/node_device_conf.c')
-rw-r--r--src/conf/node_device_conf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index c2c5a4443..c5083cc10 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1057,13 +1057,18 @@ virNodeDeviceDefParseXML(virConnectPtr conn, xmlXPathContextPtr ctxt, int create
/* Extract device name */
if (create == EXISTING_DEVICE) {
def->name = virXPathString(conn, "string(./name[1])", ctxt);
+
+ if (!def->name) {
+ virNodeDeviceReportError(conn, VIR_ERR_NO_NAME, NULL);
+ goto error;
+ }
} else {
def->name = strdup("new device");
- }
- if (!def->name) {
- virNodeDeviceReportError(conn, VIR_ERR_NO_NAME, NULL);
- goto error;
+ if (!def->name) {
+ virReportOOMError(conn);
+ goto error;
+ }
}
/* Extract device parent, if any */