aboutsummaryrefslogtreecommitdiffstats
path: root/addr2line.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-13 08:48:30 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-13 08:48:30 +0000
commit9cffbb4ffc77b60fd6b2791489113c4ba5009f86 (patch)
tree60b13f39f7a61572a75d4e5bfce55d7e8cc5bea8 /addr2line.c
parent2b4bcd072f5f27a1dbc52bb9e2176aa1644992d1 (diff)
downloadruby-9cffbb4ffc77b60fd6b2791489113c4ba5009f86.tar.gz
Don't free allocated uncompressed_debug_line until backtrace is printed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'addr2line.c')
-rw-r--r--addr2line.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/addr2line.c b/addr2line.c
index 68dd6f8970..2a13c5ded6 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -127,6 +127,7 @@ struct obj_info {
const char *path; /* object path */
void *mapped;
size_t mapped_size;
+ void *uncompressed_debug_line;
uintptr_t base_addr;
obj_info_t *next;
};
@@ -503,20 +504,18 @@ parse_compressed_debug_line(int num_traces, void **traces,
if (!uncompressed_debug_line) return -1;
ret = uncompress(uncompressed_debug_line, &destsize,
(const Bytef *)debug_line + sizeof(ElfW(Chdr)), size-sizeof(ElfW(Chdr)));
- if (ret != Z_OK) { /* Z_OK = 0 */
- goto finish;
- }
+ if (ret != Z_OK) goto fail;
ret = parse_debug_line(num_traces, traces,
uncompressed_debug_line,
destsize,
obj, lines, offset);
- if (ret) {
- goto finish;
- }
+ if (ret) goto fail;
+ obj->uncompressed_debug_line = uncompressed_debug_line;
+ return 0;
-finish:
+fail:
free(uncompressed_debug_line);
- return ret ? -1 : 0;
+ return -1;
}
#endif
@@ -843,6 +842,9 @@ next_line:
if (o->mapped_size) {
munmap(o->mapped, o->mapped_size);
}
+ if (o->uncompressed_debug_line) {
+ free(o->uncompressed_debug_line);
+ }
free(o);
}
free(lines);