This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/85812] [7/8/9 Regression] make_exception_ptr can leak the allocated exception if construction throws
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 17 May 2018 10:19:22 +0000
- Subject: [Bug libstdc++/85812] [7/8/9 Regression] make_exception_ptr can leak the allocated exception if construction throws
- Auto-submitted: auto-generated
- References: <bug-85812-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85812
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Known to work| |6.4.0
Target Milestone|--- |7.4
Summary|make_exception_ptr can leak |[7/8/9 Regression]
|the allocated exception if |make_exception_ptr can leak
|construction throws |the allocated exception if
| |construction throws
Known to fail| |7.3.0, 8.1.0, 9.0
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Testcase:
#include <exception>
struct E {
E() = default;
E(const E&) { throw 1; }
};
int main()
{
std::make_exception_ptr(E{});
}
=================================================================
==23465==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 129 byte(s) in 1 object(s) allocated from:
#0 0x7f0ae56eb2d0 in __interceptor_malloc
/home/jwakely/src/gcc/gcc-7/libsanitizer/asan/asan_malloc_linux.cc:62
#1 0x7f0ae531f8cf in __cxa_allocate_exception
/home/jwakely/src/gcc/gcc-7/libstdc++-v3/libsupc++/eh_alloc.cc:272
#2 0x400d5f in main /tmp/ex.cc:10
#3 0x7f0ae499af29 in __libc_start_main (/lib64/libc.so.6+0x20f29)
SUMMARY: AddressSanitizer: 129 byte(s) leaked in 1 allocation(s).
This started with 7.1 due to r239664 for Bug 68297