diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-10 07:19:53 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-10 07:19:53 +0000 |
commit | b8eb8997857afe3ba73af329d7f65602db6845ee (patch) | |
tree | b3e65ea4c6742c7bf3d6aec314bc10bbce52c220 /addr2line.c | |
parent | ddffb9bb9b065f266ff845415d508877bdadab20 (diff) |
* addr2line.c (append_obj): clear allocated memory.
* addr2line.c (rb_dump_backtrace_with_lines): free `base_addrs'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'addr2line.c')
-rw-r--r-- | addr2line.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/addr2line.c b/addr2line.c index 941d52db51..c936b52a26 100644 --- a/addr2line.c +++ b/addr2line.c @@ -423,7 +423,7 @@ fill_lines(int num_traces, void **traces, int check_debuglink, static void append_obj(obj_info_t **objp) { - obj_info_t *newobj = malloc(sizeof(obj_info_t)); + obj_info_t *newobj = calloc(1, sizeof(obj_info_t)); if (*objp) (*objp)->next = newobj; *objp = newobj; } @@ -668,7 +668,7 @@ rb_dump_backtrace_with_lines(int num_traces, void **traces) o = obj; obj->path = main_path; fill_lines(num_traces, traces, 1, &obj, lines, -1); - for (i=0; o=o->next; i++) { + for (i=0; o=o->next; i++) { /* 1 or 2 times */ base_addrs[i] = (void *)o->base_addr; } } @@ -741,6 +741,7 @@ next_line: free(o); } free(lines); + free(base_addrs); } /* From FreeBSD's lib/libstand/printf.c */ |