提交 20eb73e9 编写于 作者: E Eric Blake

conf: plug memory leaks

* src/conf/domain_conf.c (virDomainGraphicsDefParseXML)
(virDomainDeviceVirtioSerialAddressParseXML)
(virDomainDiskDefFree): Free various leaks.
上级 7d5e79ff
...@@ -524,6 +524,7 @@ void virDomainDiskDefFree(virDomainDiskDefPtr def) ...@@ -524,6 +524,7 @@ void virDomainDiskDefFree(virDomainDiskDefPtr def)
for (i = 0 ; i < def->nhosts ; i++) for (i = 0 ; i < def->nhosts ; i++)
virDomainDiskHostDefFree(&def->hosts[i]); virDomainDiskHostDefFree(&def->hosts[i]);
VIR_FREE(def->hosts);
VIR_FREE(def); VIR_FREE(def);
} }
...@@ -1420,6 +1421,7 @@ virDomainDeviceVirtioSerialAddressParseXML( ...@@ -1420,6 +1421,7 @@ virDomainDeviceVirtioSerialAddressParseXML(
cleanup: cleanup:
VIR_FREE(controller); VIR_FREE(controller);
VIR_FREE(bus); VIR_FREE(bus);
VIR_FREE(port);
return ret; return ret;
} }
...@@ -3491,6 +3493,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) { ...@@ -3491,6 +3493,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
if (!name || !mode) { if (!name || !mode) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("spice channel missing name/mode")); _("spice channel missing name/mode"));
VIR_FREE(name);
VIR_FREE(mode);
goto error; goto error;
} }
...@@ -3498,14 +3502,20 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) { ...@@ -3498,14 +3502,20 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown spice channel name %s"), _("unknown spice channel name %s"),
name); name);
VIR_FREE(name);
VIR_FREE(mode);
goto error; goto error;
} }
if ((modeval = virDomainGraphicsSpiceChannelModeTypeFromString(mode)) < 0) { if ((modeval = virDomainGraphicsSpiceChannelModeTypeFromString(mode)) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown spice channel mode %s"), _("unknown spice channel mode %s"),
mode); mode);
VIR_FREE(name);
VIR_FREE(mode);
goto error; goto error;
} }
VIR_FREE(name);
VIR_FREE(mode);
def->data.spice.channels[nameval] = modeval; def->data.spice.channels[nameval] = modeval;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册