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
This commit is contained in:
Christopher Ferris 2016-11-15 14:04:16 -08:00
parent f97b27a9c0
commit a19bc2d4ed

View file

@ -142,6 +142,8 @@ std::string backtrace_string(const uintptr_t* frames, size_t frame_count) {
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;