mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-14 12:58:33 +03:00
conf: use g_autofree to ensure automatic cleanup
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
d73cd87e81
commit
c125556c12
@ -53,9 +53,8 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
virPCIDeviceAddressPtr addr)
|
||||
{
|
||||
virZPCIDeviceAddress def = { 0 };
|
||||
char *uid;
|
||||
char *fid;
|
||||
int ret = -1;
|
||||
g_autofree char *uid = NULL;
|
||||
g_autofree char *fid = NULL;
|
||||
|
||||
uid = virXMLPropString(node, "uid");
|
||||
fid = virXMLPropString(node, "fid");
|
||||
@ -64,27 +63,23 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node,
|
||||
virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Cannot parse <address> 'uid' attribute"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fid &&
|
||||
virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Cannot parse <address> 'fid' attribute"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!virZPCIDeviceAddressIsEmpty(&def) &&
|
||||
!virZPCIDeviceAddressIsValid(&def))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
addr->zpci = def;
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(uid);
|
||||
VIR_FREE(fid);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user