Re: [Libvir] Patch to attach/detach virtual devices on a running domain
From: michel ponceau bull net
To: "Daniel P. Berrange" <berrange redhat com>
Cc: libvir-list redhat com
Subject: Re: [Libvir] Patch to attach/detach virtual devices on a running domain
Date: Wed, 15 Nov 2006 15:14:16 +0100
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 !