[xml] xmlFree crashing




HI,
I am using the binaries built at zlatkovic.com. When I am calling xmlFree after calling xmlNodeListGetString, the program is crashing with a really weird unhandled exception

Unhandled exception at 0x026332a0 in dconnect.exe: 0xC000001E:  An attempt was made to execute an invalid lock sequence.


For structural reasons I am not linking the DLL into my application by using LoadLibrary and GetProcAddress. I am pretty sure the problem is that the xmlFree address is incorrect, or I am passing an invalid argument but I cant see what it could be.


My code is shown below


xmlFreeFunc lpXMLFREE = NULL;

HMODULE hXML = NULL;

BOOL InitXML()
{
        if (hXML)
                return(TRUE);

        hXML = LoadLibrary("libxml2.dll");
        if (hXML == NULL)
                return(FALSE);

        if (!(lpXMLNEWDOC = (LPXMLNEWDOC) GetProcAddress (hXML, "xmlNewDoc")))
                return(FALSE);
        if (!(lpXMLFREEDOC = (LPXMLFREEDOC) GetProcAddress (hXML, "xmlFreeDoc")))
                return(FALSE);
        if (!(lpXMLNEWNODE = (LPXMLNEWNODE) GetProcAddress (hXML, "xmlNewNode")))
                return(FALSE);
        if (!(lpXMLDOCSETROOTELEMENT = (LPXMLDOCSETROOTELEMENT) GetProcAddress (hXML, "xmlDocSetRootElement")))
                return(FALSE);
        if (!(lpXMLDOCGETROOTELEMENT = (LPXMLDOCGETROOTELEMENT) GetProcAddress (hXML, "xmlDocGetRootElement")))
                return(FALSE);
        if (!(lpXMLNEWNS = (LPXMLNEWNS) GetProcAddress (hXML, "xmlNewNs")))
                return(FALSE);
        if (!(lpXMLNEWCHILD = (LPXMLNEWCHILD) GetProcAddress (hXML, "xmlNewChild")))
                return(FALSE);
        if (!(lpXMLNEWTEXTCHILD = (LPXMLNEWTEXTCHILD) GetProcAddress (hXML, "xmlNewTextChild")))
                return(FALSE);
        if (!(lpXMLSAVEFORMATFILEENC = (LPXMLSAVEFORMATFILEENC) GetProcAddress (hXML, "xmlSaveFormatFileEnc")))
                return(FALSE);
        if (!(lpXMLSAVEFORMATFILE = (LPXMLSAVEFORMATFILE) GetProcAddress (hXML, "xmlSaveFormatFile")))
                return(FALSE);
        if (!(lpXMLPARSEFILE = (LPXMLPARSEFILE) GetProcAddress (hXML, "xmlParseFile")))
                return(FALSE);
        if (!(lpXMLSTRCMP = (LPXMLSTRCMP) GetProcAddress (hXML, "xmlStrcmp")))
                return(FALSE);
        if (!(lpXMLNODELISTGETSTRING = (LPXMLNODELISTGETSTRING)GetProcAddress(hXML, "xmlNodeListGetString")))
                return(FALSE);
        if (!(lpXMLFREE = (xmlFreeFunc)GetProcAddress(hXML, "xmlFree")))
                return(FALSE);
        return(TRUE);
}

void msaxmlFree(void *v)
{
        lpXMLFREE(v);
}

Phil Salomon
Managing Director
Micronet Systems Australia

Phone: 02 9542 2000
Fax    : 02 9542 2100
email  : phils micronet com au


Disclaimer:
The email and any files transmitted with it are confidential and may be subject to copyright. They are intended solely for the use of the individual or entity to whom they are addressed. If you have received this message in error please notify Micronet Systems (Australia) Pty Ltd immediately by return email or by calling +61 2 9542 2000.  The republication and re-dissemination are strictly prohibited without the express prior consent of Micronet Systems (Australia) Pty Ltd.
Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Micronet Systems (Australia) Pty Ltd except where an authorised sender specifically states them to be the views of Micronet Systems (Australia) Pty Ltd.
It is your responsibility to verify this email and any attachments for the presence of viruses. Micronet Systems (Australia) Pty Ltd accepts no liability for any damage caused by any virus transmitted.


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