diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index f0ea41dfda8c37a9ec68ca1d07b7c1dcb4469288..cc3d3d90e74112c9f04eabfefbe39756bdc7caa5 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -834,6 +834,12 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) } type = virXPathString("string(./@type)", ctxt); + if (type == NULL) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("storage pool missing type attribute")); + goto error; + } + if ((ret->type = virStoragePoolTypeFromString(type)) < 0) { virReportError(VIR_ERR_XML_ERROR, _("unknown storage pool type %s"), type); @@ -956,8 +962,6 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) goto error; } - return ret; - cleanup: VIR_FREE(uuid); VIR_FREE(type);