提交 434daaff 编写于 作者: M Matthias Bolte

cpu: Fix memory leaks in x86FeatureLoad and x86ModelLoad

Also backup and restore the original ctxt->node value in x86FeatureLoad.
上级 156e36a2
...@@ -274,6 +274,7 @@ x86FeatureLoad(xmlXPathContextPtr ctxt, ...@@ -274,6 +274,7 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
{ {
struct x86_map *map = data; struct x86_map *map = data;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
xmlNodePtr ctxt_node = ctxt->node;
struct x86_feature *feature = NULL; struct x86_feature *feature = NULL;
int ret = 0; int ret = 0;
int i; int i;
...@@ -340,6 +341,9 @@ x86FeatureLoad(xmlXPathContextPtr ctxt, ...@@ -340,6 +341,9 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
} }
out: out:
ctxt->node = ctxt_node;
VIR_FREE(nodes);
return ret; return ret;
no_memory: no_memory:
...@@ -664,6 +668,7 @@ x86ModelLoad(xmlXPathContextPtr ctxt, ...@@ -664,6 +668,7 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
} }
out: out:
VIR_FREE(nodes);
return ret; return ret;
no_memory: no_memory:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册