Re: [libxml++] Memory leak?
- From: "Morten Hanssen" <morten hanssen pd politiet no>
- To: <libxmlplusplus-general lists sourceforge net>
- Subject: Re: [libxml++] Memory leak?
- Date: Wed, 4 Jun 2003 14:14:00 +0200
On Tuesday, June 03, 2003 10:16 AM, Murray Cumming wrote:
> It sounds sensible.
>
> 1. Does the leak happen with the examples?
The leak is present in the dom-builder example, because it use the write_to_string() function.
> 2. Have you tried your fix.
Yes, it seemed to work fine.
> 3. If it works then could you submit a patch?
Well, I'm writing this at work (which is were we use libxml++), and use of internet is pretty restricted; which means that the computer i'm writing this on is not in any way connected to my development computer, so making a patch will require quite some hassle. I was hoping that one of the maintainers could hopefully just fix it, by inserting the following code at the end of write_to_string() and write_to_string_formatted()
// Create a std::string copy of the buffer
std::string RetString((char*)buffer, length);
// Deletes the original buffer
xmlFree(buffer);
// Return a copy of the string
return RetString;
Instead of this line:
return std::string((char*)buffer, length);
Btw. why is there a write_to_string() and a write_to_string_formatted() with almost identical implementations? Wouldn't it be a better idea to let write_to_string() take a boolean parameter which says whether to format or not?
Anyway, hope this helps.
Morten.
******************************* (on mailgw)
email-body was scanned. No virus was found.
*******************************
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]