mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 12:03:41 +01:00
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.
This commit is contained in:
parent
c91974f30f
commit
b5cbcaee13
1 changed files with 2 additions and 2 deletions
|
@ -119,7 +119,7 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local)
|
||||||
}
|
}
|
||||||
|
|
||||||
*bufsize = shdr->sh_size;
|
*bufsize = shdr->sh_size;
|
||||||
*buf = malloc (*bufsize);
|
GET_MEMORY(*buf, *bufsize);
|
||||||
|
|
||||||
memcpy(*buf, shdr->sh_offset + ei.image, *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)
|
if (!err)
|
||||||
{
|
{
|
||||||
fdesc = malloc (sizeof (struct unw_debug_frame_list));
|
GET_MEMORY(fdesc, sizeof (struct unw_debug_frame_list));
|
||||||
|
|
||||||
fdesc->start = start;
|
fdesc->start = start;
|
||||||
fdesc->end = end;
|
fdesc->end = end;
|
||||||
|
|
Loading…
Reference in a new issue