diff options
author | xtkoba <[email protected]> | 2021-04-29 23:53:55 +0900 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2021-06-28 14:06:28 -0700 |
commit | d795f494a89e0d9498dfedc54b8a98acc2bc4d7b (patch) | |
tree | c0a13ae1b9ee330693a6310d4a90647ec08c2631 /addr2line.c | |
parent | b7d01b0d1bf0526e12e01c58963453f9711c67b5 (diff) |
Avoid `free(3)`ing invalid pointer
Fixes [Bug #17794]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4611
Diffstat (limited to 'addr2line.c')
-rw-r--r-- | addr2line.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; } |