mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
0efd00bf4f
commit
0ca505347c
1 changed files with 10 additions and 8 deletions
18
addr2line.c
18
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);
|
||||
|
|
Loading…
Reference in a new issue