mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
storage_conf: Don't leak "uuid" in virStoragePoolDefParseAuthCephx
Any string returned from virXPathString should be freed.
This commit is contained in:
parent
49598fab61
commit
61c6227341
@ -466,6 +466,8 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt,
|
|||||||
virStoragePoolAuthCephxPtr auth)
|
virStoragePoolAuthCephxPtr auth)
|
||||||
{
|
{
|
||||||
char *uuid = NULL;
|
char *uuid = NULL;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
auth->username = virXPathString("string(./auth/@username)", ctxt);
|
auth->username = virXPathString("string(./auth/@username)", ctxt);
|
||||||
if (auth->username == NULL) {
|
if (auth->username == NULL) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
@ -485,19 +487,22 @@ virStoragePoolDefParseAuthCephx(xmlXPathContextPtr ctxt,
|
|||||||
if (auth->secret.usage != NULL) {
|
if (auth->secret.usage != NULL) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("either auth secret uuid or usage expected"));
|
_("either auth secret uuid or usage expected"));
|
||||||
return -1;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (virUUIDParse(uuid, auth->secret.uuid) < 0) {
|
if (virUUIDParse(uuid, auth->secret.uuid) < 0) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
"%s", _("invalid auth secret uuid"));
|
"%s", _("invalid auth secret uuid"));
|
||||||
return -1;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
auth->secret.uuidUsable = true;
|
auth->secret.uuidUsable = true;
|
||||||
} else {
|
} else {
|
||||||
auth->secret.uuidUsable = false;
|
auth->secret.uuidUsable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
ret = 0;
|
||||||
|
cleanup:
|
||||||
|
VIR_FREE(uuid);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user