diff options
author | Dave Watson <davejwatson@fb.com> | 2018-04-10 10:55:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-10 10:55:34 -0700 |
commit | b5cbcaee13233ddbc2e6a3fffe85374031f51000 (patch) | |
tree | c52d5cee5237139a47a6508ed0d69bebdb24fecd | |
parent | c91974f30feac05055621e33ca101a371236c786 (diff) | |
download | libunwind-b5cbcaee13233ddbc2e6a3fffe85374031f51000.tar.gz |
dwarf: do not allocate in load_debug_frame (#72)
load_debug_frame calls malloc() in a couple spots, use mmap via
GET_MEMORY instead. These call paths are infrequent, and are never
freed.
Found by running tcmalloc unit tests on aarch64, when DEBUG_FRAME support is on.
-rw-r--r-- | src/dwarf/Gfind_proc_info-lsb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dwarf/Gfind_proc_info-lsb.c b/src/dwarf/Gfind_proc_info-lsb.c index c18783e0..58fa51d0 100644 --- a/src/dwarf/Gfind_proc_info-lsb.c +++ b/src/dwarf/Gfind_proc_info-lsb.c @@ -119,7 +119,7 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local) } *bufsize = shdr->sh_size; - *buf = malloc (*bufsize); + GET_MEMORY(*buf, *bufsize); memcpy(*buf, shdr->sh_offset + ei.image, *bufsize); @@ -208,7 +208,7 @@ locate_debug_info (unw_addr_space_t as, unw_word_t addr, const char *dlname, if (!err) { - fdesc = malloc (sizeof (struct unw_debug_frame_list)); + GET_MEMORY(fdesc, sizeof (struct unw_debug_frame_list)); fdesc->start = start; fdesc->end = end; |