This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch-rfc] N2179: Exception Propagation in C++
Sebastian Redl wrote:
Yes, I discovered this too, to my great embarrassment. Attached patch
solves the leak (verified with valgrind). I'm currently running the
testsuite with it. It's not finished, but it's past the exception_ptr
tests; no failures.
Functionally equivalent, slightly better. I moved the deallocation below
the test for the correct calling mechanism and removed the redundant
comment.
Same ChangeLog entry applies.
Sebastian
Index: libstdc++-v3/libsupc++/eh_ptr.cc
===================================================================
--- libstdc++-v3/libsupc++/eh_ptr.cc (revision 139372)
+++ libstdc++-v3/libsupc++/eh_ptr.cc (working copy)
@@ -199,6 +199,8 @@
if (code != _URC_FOREIGN_EXCEPTION_CAUGHT && code != _URC_NO_REASON)
__terminate (header->terminateHandler);
+ __cxa_free_dependent_exception (dep);
+
if (__gnu_cxx::__exchange_and_add_dispatch (&header->referenceCount, -1) == 0)
{
if (header->exceptionDestructor)