提交 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, ...@@ -53,9 +53,8 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node,
virPCIDeviceAddressPtr addr) virPCIDeviceAddressPtr addr)
{ {
virZPCIDeviceAddress def = { 0 }; virZPCIDeviceAddress def = { 0 };
char *uid; g_autofree char *uid = NULL;
char *fid; g_autofree char *fid = NULL;
int ret = -1;
uid = virXMLPropString(node, "uid"); uid = virXMLPropString(node, "uid");
fid = virXMLPropString(node, "fid"); fid = virXMLPropString(node, "fid");
...@@ -64,27 +63,23 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, ...@@ -64,27 +63,23 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node,
virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) { virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'uid' attribute")); _("Cannot parse <address> 'uid' attribute"));
goto cleanup; return -1;
} }
if (fid && if (fid &&
virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) { virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot parse <address> 'fid' attribute")); _("Cannot parse <address> 'fid' attribute"));
goto cleanup; return -1;
} }
if (!virZPCIDeviceAddressIsEmpty(&def) && if (!virZPCIDeviceAddressIsEmpty(&def) &&
!virZPCIDeviceAddressIsValid(&def)) !virZPCIDeviceAddressIsValid(&def))
goto cleanup; return -1;
addr->zpci = def; addr->zpci = def;
ret = 0;
cleanup: return 0;
VIR_FREE(uid);
VIR_FREE(fid);
return ret;
} }
void void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册