ruby-changes:33471
From: naruse <ko1@a...>
Date: Thu, 10 Apr 2014 16:19:58 +0900 (JST)
Subject: [ruby-changes:33471] naruse:r45550 (trunk): * addr2line.c (append_obj): clear allocated memory.
naruse 2014-04-10 16:19:53 +0900 (Thu, 10 Apr 2014) New Revision: 45550 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45550 Log: * addr2line.c (append_obj): clear allocated memory. * addr2line.c (rb_dump_backtrace_with_lines): free `base_addrs'. Modified files: trunk/ChangeLog trunk/addr2line.c Index: ChangeLog =================================================================== --- ChangeLog (revision 45549) +++ ChangeLog (revision 45550) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Apr 10 15:01:06 2014 NARUSE, Yui <naruse@r...> + + * addr2line.c (append_obj): clear allocated memory. + + * addr2line.c (rb_dump_backtrace_with_lines): free `base_addrs'. + Thu Apr 10 14:40:18 2014 Koichi Sasada <ko1@a...> * gc.c (rb_gc_writebarrier_unprotect_promoted): disable to dump debug Index: addr2line.c =================================================================== --- addr2line.c (revision 45549) +++ addr2line.c (revision 45550) @@ -423,7 +423,7 @@ fill_lines(int num_traces, void **traces https://github.com/ruby/ruby/blob/trunk/addr2line.c#L423 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_tra https://github.com/ruby/ruby/blob/trunk/addr2line.c#L668 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: https://github.com/ruby/ruby/blob/trunk/addr2line.c#L741 free(o); } free(lines); + free(base_addrs); } /* From FreeBSD's lib/libstand/printf.c */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/