From d795f494a89e0d9498dfedc54b8a98acc2bc4d7b Mon Sep 17 00:00:00 2001 From: xtkoba <69125751+xtkoba@users.noreply.github.com> Date: Thu, 29 Apr 2021 23:53:55 +0900 Subject: [PATCH] Avoid `free(3)`ing invalid pointer Fixes [Bug #17794] --- addr2line.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addr2line.c b/addr2line.c index cf0a379fa6..8ee4416650 100644 --- a/addr2line.c +++ b/addr2line.c @@ -1699,6 +1699,7 @@ debug_info_read(DebugInfoReader *reader, int num_traces, void **traces, static unsigned long uncompress_debug_section(ElfW(Shdr) *shdr, char *file, char **ptr) { + *ptr = NULL; #ifdef SUPPORT_COMPRESSED_DEBUG_LINE ElfW(Chdr) *chdr = (ElfW(Chdr) *)(file + shdr->sh_offset); unsigned long destsize = chdr->ch_size; @@ -1719,6 +1720,7 @@ uncompress_debug_section(ElfW(Shdr) *shdr, char *file, char **ptr) fail: free(*ptr); + *ptr = NULL; #endif return 0; }