Re: [libxml++] Memory leak?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Le Mercredi 4 Juin 2003 14:14, Morten Hanssen a écrit :
> On Tuesday, June 03, 2003 10:16 AM, Murray Cumming wrote:

[...]

> > 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);
>

Committed.

> 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?

See the recent discussion about this in the mailing list. What we could do 
however is to use a common implementation in a private function.

>
> Anyway, hope this helps.
>

It does. Thanks.

Christophe
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+3ea3B+sU3TyOQjARArCRAJ0TxchFqdyfSAvNuYm1CQVnkIFTRgCdGxyw
d+yVg02fBBMeHphVxL1lFh4=
=7hrt
-----END PGP SIGNATURE-----





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