提交 c125556c 编写于 作者: S Shalini Chellathurai Saroja 提交者: Andrea Bolognani

conf: use g_autofree to ensure automatic cleanup

Signed-off-by: NBjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: NShalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
上级 d73cd87e
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册