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

There is a bug in GetNetworkID(): return(ret) with ret=list[i], after free(list). It leads to process abort on free(xref) in caller XMLDevID(). I corrected this by replacing: ret = list[i]; by: ret = malloc(16); if (ret != NULL) strcpy(ret, list[i]); Our tests were successful afterwards. Daniel Veillard <veillard@redhat.com> 20/11/2006 16:50 Veuillez répondre à veillard Pour : michel.ponceau@bull.net cc : libvir-list@redhat.com Objet : Re: [Libvir] Patch to attach/detach virtual devices on a running domain On Thu, Nov 16, 2006 at 12:19:13PM -0500, Daniel Veillard wrote:
On Tue, Nov 14, 2006 at 10:05:47AM -0500, Daniel Veillard wrote:
5/ virDomainXMLDevID does direct acces to xs_directory() and xs_read(), that's not proper it should not call xenStore directly that need to be cleaned up, define one high level function exported from xs_internal.[ch] and call that but no direct access should be done that leads to unmaintainable code.
That still need to be isolated, I added a TODO in src/xml.c to this effect.
Okay I have done it, as a new function xenStoreDomainGetNetworkID() from xs_internal.[ch] Could you check out the version from CVS and verify I didn't added any regression ? thanks, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Tue, Nov 21, 2006 at 05:27:20PM +0100, michel.ponceau@bull.net wrote:
There is a bug in GetNetworkID(): return(ret) with ret=list[i], after free(list). It leads to process abort on free(xref) in caller XMLDevID(). I corrected this by replacing: ret = list[i]; by: ret = malloc(16); if (ret != NULL) strcpy(ret, list[i]); Our tests were successful afterwards.
Dohh, list is being freed before exit ... I changed that to ret = strdup(list[i]); if strdup fails this will return NULL the error code, and that's simpler, thanks ! Daniel P.S.: could you provide some of the XML you use for your tests ? that would help me write the associated docs and do a bit of testing on my own. -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (2)
-
Daniel Veillard
-
michel.ponceau@bull.net