[libvirt] [PATCH] cygwin: fix abort of virsh on my system

Chris Lalancette clalance at redhat.com
Thu May 6 18:28:18 UTC 2010


On 05/06/2010 02:11 PM, Stefan Berger wrote:
> This strange patch fixes aborts of virsh on my system. It seems that the
> string returned by xmlSaveUri is owned by the xml library??

Hm, I don't think so, at least not according to the documentation:

Function: xmlSaveUri

xmlChar *	xmlSaveUri		(xmlURIPtr uri)

Save the URI as an escaped string
uri:	pointer to an xmlURI
Returns:	a new string (to be deallocated by caller)

The code in libxml2 also seems to confirm this, although it's not entirely
straightforward:

xmlChar *
xmlSaveUri(xmlURIPtr uri) {
    xmlChar *ret = NULL;
    xmlChar *temp;
    const char *p;
    int len;
    int max;

    if (uri == NULL) return(NULL);


    max = 80;
    ret = (xmlChar *) xmlMallocAtomic((max + 1) * sizeof(xmlChar));

...
    ret[len] = 0;
    return(ret);
}

So something else might be going on.  What version of libxml2
are you currently building against?

-- 
Chris Lalancette




More information about the libvir-list mailing list