The transcode method returns memory which the caller is responsible for. So you have at least two memory leaks in your code.
 
You have to do:
 
char * p = x.transcode();
// do stuff with p
delete [] p;
 
Note, the above will work only ifyou have the same allocator as the compiled xerces library you are wokring with.
 
Otherwise I recommend using XMLString::transocde. One of the overloads takes a buffer which you allocate and are hence responsible for.
 
Samar

-----Original Message-----
From: renganathan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 20, 2001 23:23
To: [EMAIL PROTECTED]
Subject: Is this another solution to transcoded memory problem...?

Dear All,
 
    I am not gettting any errors when I try to solve the problem of freeing memory in this fashion.
 
My present doubt is whether the transcoded (twice) memory below, will be deleted by itself  or not...?
 
My code is:
 
 char* TempAttrvalue ;
     int L = strlen( map.getNodeValue().transcode());                // map is a DOM_Node
     
     TempAttrvalue = ( char*) malloc(L+1);
     XMLString::copyString(TempAttrvalue,map.getNodeValue().transcode());
     XMLString::trim(TempAttrvalue);
    ---
    ---
    ---
    free(TempAttrvalue);
 
 
    Thanks for any help.
 
Regards
Rengan
*********************************************
Read DIGITALLY  & Save TREES !!
*********************************************
 

Reply via email to