diff options
-rw-r--r-- | src/sys-assert/sys-assert.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sys-assert/sys-assert.c b/src/sys-assert/sys-assert.c index 212e966..63f362e 100644 --- a/src/sys-assert/sys-assert.c +++ b/src/sys-assert/sys-assert.c @@ -112,6 +112,7 @@ static int trace_symbols(void *const *array, int size, struct addr_node *start, unsigned int symtab_index = 0; int num_st = 0; int found_symtab = 0; + int is_mapped = 0; for (cnt = 0; cnt < size; cnt++) { num_st = 0; @@ -276,6 +277,7 @@ static int trace_symbols(void *const *array, int size, struct addr_node *start, (void *)mmap(0, FUNC_NAME_MAX_LEN, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + is_mapped = 1; ret = read(file, (void *)info_funcs.dli_sname, FUNC_NAME_MAX_LEN); if (ret < 0) @@ -304,6 +306,8 @@ static int trace_symbols(void *const *array, int size, struct addr_node *start, cnt, info_funcs.dli_sname, (info_funcs.dli_saddr - array[cnt]), array[cnt], info_funcs.dli_fname, offset_addr); + if (is_mapped) + munmap((void *)info_funcs.dli_sname, FUNC_NAME_MAX_LEN); } else { fprintf_fd(fd, "%2d: (%p) [%s] + %p\n", cnt, array[cnt], info_funcs.dli_fname, offset_addr); |