[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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




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 redhat com>

14/11/2006 19:36
Veuillez répondre à "Daniel P. Berrange"

       
        Pour :        michel ponceau bull net
        cc :        libvir-list 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 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  -=|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]