Fix uninitialized variable usage.
If the dladdr call fails, then info.dli_fname will be unitialized.
Make sure that this can't happen.
Bug: 32907235
Test: Enabled malloc debug on an angler and verified that function names
Test: still work.
Change-Id: I738e66d9f37bce07bc4c10f1f9bac11fbfdae2c7
diff --git a/libc/malloc_debug/backtrace.cpp b/libc/malloc_debug/backtrace.cpp
index 18ce8b8..75a255c 100644
--- a/libc/malloc_debug/backtrace.cpp
+++ b/libc/malloc_debug/backtrace.cpp
@@ -142,6 +142,8 @@
if (dladdr(reinterpret_cast<void*>(frames[frame_num]), &info) != 0) {
offset = reinterpret_cast<uintptr_t>(info.dli_saddr);
symbol = info.dli_sname;
+ } else {
+ info.dli_fname = nullptr;
}
uintptr_t rel_pc = offset;