[Patch] Fix libstdc++/12540

Paolo Carlini pcarlini@unitus.it
Thu Oct 16 16:41:00 GMT 2003


Hi again,

further testing (LC_ALL unset, LANG = xxx (!= "C"), at least one
category set to != xxx) revealed another possible memory leak path,
which may occur if memory allocation inside __str throws.

Therefore, instead of dealing explicitly, with this case too, seems
much better to me to change my original code for locale(const char*)
to not use strdup at all, but instead another basic_string for
__res too.

I have therefore tested the below, which I will commit soon.

Now, *always* for 12352 :)

==3673== LEAK SUMMARY:
==3673==    definitely lost: 0 bytes in 0 blocks.
==3673==    possibly lost:   0 bytes in 0 blocks.
==3673==    still reachable: 17840 bytes in 6 blocks.
==3673==    suppressed: 0 bytes in 0 blocks.

Paolo.

//////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_12540_3
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031016/eb3557b0/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_12540_3
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20031016/eb3557b0/attachment-0001.ksh>


More information about the Libstdc++ mailing list