[Libvir] Patch to attach/detach virtual devices on a running domain

michel.ponceau at bull.net michel.ponceau at bull.net
Wed Nov 15 14:14:16 UTC 2006


I cannot see the bug in virParseXMLDevice.  The 'error' label sequence is 
ended by 'goto cleanup', and 'cleanup' sequence calls xmlFreeDoc(xml). Is 
it not the way to free the xmlDocPtr object 'xml'?
Maybe I should reverse the sequence order to be more clear, as follows:
+    goto cleanup;
+error:
+    free(buf.content);
+    buf.content = NULL;
+cleanup:
+    if (xml != NULL)
+        xmlFreeDoc(xml);
+    return buf.content;



"Daniel P. Berrange" <berrange at redhat.com>
14/11/2006 19:36
Veuillez répondre à "Daniel P. Berrange"

 
        Pour :  michel.ponceau at bull.net
        cc :    libvir-list at redhat.com
        Objet : Re: [Libvir] Patch to attach/detach virtual devices on a running domain

On Tue, Nov 14, 2006 at 03:34:05PM +0100, michel.ponceau at bull.net wrote:
> This patch adds to Libvirt-0.1.8 the two functions described in my 
> preceding mail. It has been tested in our Bull environment.

This looks good to me - only one small bug I see - in the 
virParseXMLDevice
function there is a memory leak. If you take 'goto errror' path through
the function, then the xmlDocPtr object will never be free'd. Thanks for
taking the time to implement all this !

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 
-=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 
-=| 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20061115/686cd691/attachment-0001.htm>


More information about the libvir-list mailing list