Skip to content

Commit c88fe7e

Browse files
authored
Merge pull request ceph#63300 from tchaikov/assert-fix-leaks
common: fix backtrace leak in __ceph_abort and friends Reviewed-by: Matan Breizman <[email protected]>
2 parents 463a0ba + da8f614 commit c88fe7e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/common/assert.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ namespace ceph {
154154
ceph_pthread_getname(g_assert_thread_name, sizeof(g_assert_thread_name));
155155

156156
BufAppender ba(g_assert_msg, sizeof(g_assert_msg));
157-
BackTrace *bt = new ClibBackTrace(1);
157+
auto bt = std::make_unique<ClibBackTrace>(1);
158158
ba.printf("%s: In function '%s' thread %llx time %s\n"
159159
"%s: %d: FAILED ceph_assert(%s)\n",
160160
file, func, (unsigned long long)pthread_self(), tss.str().c_str(),
@@ -212,7 +212,7 @@ namespace ceph {
212212
g_assert_thread = (unsigned long long)pthread_self();
213213
ceph_pthread_getname(g_assert_thread_name, sizeof(g_assert_thread_name));
214214

215-
BackTrace *bt = new ClibBackTrace(1);
215+
auto bt = std::make_unique<ClibBackTrace>(1);
216216
snprintf(g_assert_msg, sizeof(g_assert_msg),
217217
"%s: In function '%s' thread %llx time %s\n"
218218
"%s: %d: ceph_abort_msg(\"%s\")\n", file, func,
@@ -254,7 +254,7 @@ namespace ceph {
254254
ceph_pthread_getname(g_assert_thread_name, sizeof(g_assert_thread_name));
255255

256256
BufAppender ba(g_assert_msg, sizeof(g_assert_msg));
257-
BackTrace *bt = new ClibBackTrace(1);
257+
auto bt = std::make_unique<ClibBackTrace>(1);
258258
ba.printf("%s: In function '%s' thread %llx time %s\n"
259259
"%s: %d: abort()\n",
260260
file, func, (unsigned long long)pthread_self(), tss.str().c_str(),

0 commit comments

Comments
 (0)