mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
Resolve memory leak found by valgrind
Commit '6afdfc8e' adjusted the exit and error paths to go through the error and cleanup labels, but neglected to remove the return ret prior to cleanup. Also noted the 'type' xml string fetch was never checked for NULL which could lead to some interesting results.
This commit is contained in:
parent
177046753f
commit
2f3e7f1e36
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user