summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunmin Lee <sunm.lee@samsung.com>2017-04-05 16:53:29 +0900
committerSunmin Lee <sunm.lee@samsung.com>2017-04-05 17:22:37 +0900
commitcc9f1be614664565cf5f96ae38b214c4dbeedd76 (patch)
treeae5d8a2b8c2babfbbfefc4df58aa3c6c14c57096
parentd8712d5992908a12d42e0f194bb1078001775c8d (diff)
downloadcrash-worker-submit/tizen/20170405.094846.tar.gz
crash-worker-submit/tizen/20170405.094846.tar.bz2
crash-worker-submit/tizen/20170405.094846.zip
Unmap the memory after using it if it was mmaped. Change-Id: Ia567c165ac09308a57ae8bb5eac4a9a2a524ec15 Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
-rw-r--r--src/sys-assert/sys-assert.c4
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);