[libcxx-commits] [PATCH] D123228: [libc++][WIP] Implement P0881R7 (std::stacktrace)
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Apr 10 05:17:55 PDT 2022
philnik marked 2 inline comments as done.
philnik added inline comments.
================
Comment at: libcxx/src/stacktrace/stacktrace_entry.cpp:40
+ int status;
+ char* const demangeled_name = __cxxabiv1::__cxa_demangle(mangled_name.get(), nullptr, 0, &status);
+
----------------
Mordante wrote:
> When line 45 throws the pointer leaks.
> I would suggest to do something like
> ```
> // Unused; the returned pointer is used to test the conversion status.
> int __s;
> unique_ptr<char, void (*)(void*)> __demangled{abi::__cxa_demangle(__name, nullptr, 0, &__s), std::free};
> ```
> (I wrote this for a libc++ formatting experiment.)
Thanks, good catch!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123228/new/
https://reviews.llvm.org/D123228
More information about the libcxx-commits
mailing list