[Libvirt-cim] [PATCH] This fixes a potential crash if _get_domain() is unable to properly parse the dom XML

Dan Smith danms at us.ibm.com
Tue Nov 13 01:35:02 UTC 2007


KR> Yep, good call.  Although, if we fall through here, we run into
KR> problems with the (*dominfo)->dev_mem_ct = get_mem_devices(dom,
KR> &(*dominfo)->dev_mem); related pieces since dominfo is NULL.  

Sorry, I didn't have the full context.

I think it's bad form to cleanup in multiple exit paths.  How about
moving the free(xml) to the end, and adding an "out" label right
before it.  Then you can free(dominfo), set it to NULL, and goto out
to free(xml) and return ret, which will be zero, signalling error to
the caller.  That would fit better with how we handle error paths
elsewhere in the code.

KR> We need to capture ret from get_domain(). 

Ah, right, okay, I see it now.  Again, I wasn't looking at the context
of the rest of the file :)

Thanks!

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20071112/611543fe/attachment.sig>


More information about the Libvirt-cim mailing list