# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1194912941 28800
# Node ID f2966070990024afbad3ee79dd5f276b0310aa2e
# Parent 4ceb57b4430b0455ef7cb68f57a8ec6ad01abeca
This fixes a potential crash if _get_domain() is unable to properly parse the dom XML.
Also fixes an issue in VSSD - if get_domaininfo() returns 0 (an error), then
instance_from_dom() needs to set ret properly so that an empty instance won't be
created.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 4ceb57b4430b -r f29660709900 libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Mon Nov 12 13:54:53 2007 -0800
+++ b/libxkutil/device_parsing.c Mon Nov 12 16:15:41 2007 -0800
@@ -575,10 +575,17 @@ int get_dominfo(virDomainPtr dom, struct
xml = virDomainGetXMLDesc(dom, 0);
if (!xml) {
free(*dominfo);
+ *dominfo = NULL;
return 0;
}
ret = _get_dominfo(xml, *dominfo);
+ if (!ret) {
+ free(*dominfo);
+ *dominfo = NULL;
+ return 0;
+ }
+
free(xml);
(*dominfo)->dev_mem_ct = get_mem_devices(dom, &(*dominfo)->dev_mem);
diff -r 4ceb57b4430b -r f29660709900 src/Virt_VSSD.c
--- a/src/Virt_VSSD.c Mon Nov 12 13:54:53 2007 -0800
+++ b/src/Virt_VSSD.c Mon Nov 12 16:15:41 2007 -0800
@@ -45,7 +45,8 @@ static int instance_from_dom(virDomainPt
CMPIObjectPath *op;
struct domain *dominfo = NULL;
- if (!get_dominfo(dom, &dominfo))
+ ret = get_dominfo(dom, &dominfo);
+ if (!ret)
goto out;
op = CMGetObjectPath(inst, NULL);