public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFA/gas] dwarf2dbg.c, plug some memory leaks.
@ 2011-03-09 20:52 Michael Snyder
  2011-03-10  0:04 ` Richard Henderson
  2011-03-10  2:19 ` Hans-Peter Nilsson
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Snyder @ 2011-03-09 20:52 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 9 bytes --]

Review?


[-- Attachment #2: dwarf2dbg.txt --]
[-- Type: text/plain, Size: 1152 bytes --]

2011-03-09  Michael Snyder  <msnyder@vmware.com>

	* dwarf2dbg.c (out_file_list): Free malloced 'dir'.
	(out_debug_info): Free malloced 'dirname' and 'comp_dir'.

Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.108
diff -u -p -r1.108 dwarf2dbg.c
--- dwarf2dbg.c	28 Feb 2011 18:32:52 -0000	1.108
+++ dwarf2dbg.c	9 Mar 2011 20:48:30 -0000
@@ -1328,6 +1328,7 @@ out_file_list (void)
       size = strlen (dir) + 1;
       cp = frag_more (size);
       memcpy (cp, dir, size);
+      xfree ((char *) dir);
     }
   /* Terminate it.  */
   out_byte ('\0');
@@ -1684,6 +1685,7 @@ out_debug_info (segT info_seg, segT abbr
       memcpy (p, dirname, len);
       INSERT_DIR_SEPARATOR (p, len);
 #endif
+      xfree ((char *) dirname);
     }
   len = strlen (files[1].filename) + 1;
   p = frag_more (len);
@@ -1694,6 +1696,7 @@ out_debug_info (segT info_seg, segT abbr
   len = strlen (comp_dir) + 1;
   p = frag_more (len);
   memcpy (p, comp_dir, len);
+  xfree ((char *) comp_dir);
 
   /* DW_AT_producer */
   sprintf (producer, "GNU AS %s", VERSION);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA/gas] dwarf2dbg.c, plug some memory leaks.
  2011-03-09 20:52 [RFA/gas] dwarf2dbg.c, plug some memory leaks Michael Snyder
@ 2011-03-10  0:04 ` Richard Henderson
  2011-03-10  0:55   ` Michael Snyder
  2011-03-10  2:19 ` Hans-Peter Nilsson
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2011-03-10  0:04 UTC (permalink / raw)
  To: Michael Snyder; +Cc: binutils

On 03/10/2011 07:51 AM, Michael Snyder wrote:
> 	* dwarf2dbg.c (out_file_list): Free malloced 'dir'.
> 	(out_debug_info): Free malloced 'dirname' and 'comp_dir'.

Ok.


r~

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA/gas] dwarf2dbg.c, plug some memory leaks.
  2011-03-10  0:04 ` Richard Henderson
@ 2011-03-10  0:55   ` Michael Snyder
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2011-03-10  0:55 UTC (permalink / raw)
  To: Richard Henderson; +Cc: binutils

Richard Henderson wrote:
> On 03/10/2011 07:51 AM, Michael Snyder wrote:
>> 	* dwarf2dbg.c (out_file_list): Free malloced 'dir'.
>> 	(out_debug_info): Free malloced 'dirname' and 'comp_dir'.
> 
> Ok.

Thanks Richard.
Checked in.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA/gas] dwarf2dbg.c, plug some memory leaks.
  2011-03-09 20:52 [RFA/gas] dwarf2dbg.c, plug some memory leaks Michael Snyder
  2011-03-10  0:04 ` Richard Henderson
@ 2011-03-10  2:19 ` Hans-Peter Nilsson
  2011-03-10 18:27   ` Michael Snyder
  1 sibling, 1 reply; 5+ messages in thread
From: Hans-Peter Nilsson @ 2011-03-10  2:19 UTC (permalink / raw)
  To: msnyder; +Cc: binutils

> Date: Wed, 09 Mar 2011 12:51:54 -0800
> From: Michael Snyder <msnyder@vmware.com>

> 	* dwarf2dbg.c (out_file_list): Free malloced 'dir'.
> 	(out_debug_info): Free malloced 'dirname' and 'comp_dir'.

One of your very recent dwarf2dbg.c changes caused my cris-elf
autotester to buzz.  Given the log message and a brief look in
that source file, I think it was this one.  (There's more than
one return in remap_debug_filename.)  The FAILs (well, the
lns.exp ones) should be visible for other targets.  Host was
x86_64, F 12.

Running /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/cris/cris.exp ...
FAIL: gas/cris/rd-dw2-1
FAIL: gas/cris/rd-dw2-10
FAIL: gas/cris/rd-dw2-11
FAIL: gas/cris/rd-dw2-12
FAIL: gas/cris/rd-dw2-13
FAIL: gas/cris/rd-dw2-14
FAIL: gas/cris/rd-dw2-15
FAIL: gas/cris/rd-dw2-2
FAIL: gas/cris/rd-dw2-3
FAIL: gas/cris/rd-dw2-4
FAIL: gas/cris/rd-dw2-5
FAIL: gas/cris/rd-dw2-6
FAIL: gas/cris/rd-dw2-7
FAIL: gas/cris/rd-dw2-8
FAIL: gas/cris/rd-dw2-9
...
Running /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/lns/lns.exp ...
FAIL: lns lns-diag-1
FAIL: lns-duplicate
FAIL: lns-common-1

In gas.log, all FAIL output looks about the same, here's one:

../as-new   -o dump.o /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/lns/lns-duplicate.s
Executing on host: sh -c {../as-new   -o dump.o /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/lns/lns-duplicate.s 2>&1}  /dev/null gas.out (timeout = 300)
*** glibc detected *** ../as-new: free(): invalid pointer: 0xfff426b1 ***
======= Backtrace: =========
/lib/libc.so.6[0xa5bac1]
/lib/libc.so.6(cfree+0x90)[0xa5f0f0]
../as-new[0x804fc03]
../as-new[0x805083b]
../as-new[0x804c4c6]
/lib/libc.so.6(__libc_start_main+0xe0)[0xa08390]
../as-new[0x80497d1]
======= Memory map: ========
... (output elided for brevity)
sh: line 1:  1116 Aborted                 ../as-new -o dump.o /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/lns/ln
s-duplicate.s 2>&1
/tmp/hpautotest-binutils/cris-axis-elf/gas/testsuite/../../binutils/readelf  -wl dump.o
Executing on host: sh -c {/tmp/hpautotest-binutils/cris-axis-elf/gas/testsuite/../../binutils/readelf  -wl dump.o >dump.
out 2>gas.stderr}  /dev/null  (timeout = 300)
readelf: Error: dump.o: Failed to read file's magic number
FAIL: lns-duplicate

brgds, H-P

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA/gas] dwarf2dbg.c, plug some memory leaks.
  2011-03-10  2:19 ` Hans-Peter Nilsson
@ 2011-03-10 18:27   ` Michael Snyder
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2011-03-10 18:27 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

OK, I'm reverting that change.


Hans-Peter Nilsson wrote:
>> Date: Wed, 09 Mar 2011 12:51:54 -0800
>> From: Michael Snyder <msnyder@vmware.com>
> 
>> 	* dwarf2dbg.c (out_file_list): Free malloced 'dir'.
>> 	(out_debug_info): Free malloced 'dirname' and 'comp_dir'.
> 
> One of your very recent dwarf2dbg.c changes caused my cris-elf
> autotester to buzz.  Given the log message and a brief look in
> that source file, I think it was this one.  (There's more than
> one return in remap_debug_filename.)  The FAILs (well, the
> lns.exp ones) should be visible for other targets.  Host was
> x86_64, F 12.
> 
> Running /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/cris/cris.exp ...
> FAIL: gas/cris/rd-dw2-1
> FAIL: gas/cris/rd-dw2-10
> FAIL: gas/cris/rd-dw2-11
> FAIL: gas/cris/rd-dw2-12
> FAIL: gas/cris/rd-dw2-13
> FAIL: gas/cris/rd-dw2-14
> FAIL: gas/cris/rd-dw2-15
> FAIL: gas/cris/rd-dw2-2
> FAIL: gas/cris/rd-dw2-3
> FAIL: gas/cris/rd-dw2-4
> FAIL: gas/cris/rd-dw2-5
> FAIL: gas/cris/rd-dw2-6
> FAIL: gas/cris/rd-dw2-7
> FAIL: gas/cris/rd-dw2-8
> FAIL: gas/cris/rd-dw2-9
> ...
> Running /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/lns/lns.exp ...
> FAIL: lns lns-diag-1
> FAIL: lns-duplicate
> FAIL: lns-common-1
> 
> In gas.log, all FAIL output looks about the same, here's one:
> 
> ../as-new   -o dump.o /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/lns/lns-duplicate.s
> Executing on host: sh -c {../as-new   -o dump.o /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/lns/lns-duplicate.s 2>&1}  /dev/null gas.out (timeout = 300)
> *** glibc detected *** ../as-new: free(): invalid pointer: 0xfff426b1 ***
> ======= Backtrace: =========
> /lib/libc.so.6[0xa5bac1]
> /lib/libc.so.6(cfree+0x90)[0xa5f0f0]
> ../as-new[0x804fc03]
> ../as-new[0x805083b]
> ../as-new[0x804c4c6]
> /lib/libc.so.6(__libc_start_main+0xe0)[0xa08390]
> ../as-new[0x80497d1]
> ======= Memory map: ========
> ... (output elided for brevity)
> sh: line 1:  1116 Aborted                 ../as-new -o dump.o /tmp/hpautotest-binutils/bsrc/src/gas/testsuite/gas/lns/ln
> s-duplicate.s 2>&1
> /tmp/hpautotest-binutils/cris-axis-elf/gas/testsuite/../../binutils/readelf  -wl dump.o
> Executing on host: sh -c {/tmp/hpautotest-binutils/cris-axis-elf/gas/testsuite/../../binutils/readelf  -wl dump.o >dump.
> out 2>gas.stderr}  /dev/null  (timeout = 300)
> readelf: Error: dump.o: Failed to read file's magic number
> FAIL: lns-duplicate
> 
> brgds, H-P

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-10 18:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09 20:52 [RFA/gas] dwarf2dbg.c, plug some memory leaks Michael Snyder
2011-03-10  0:04 ` Richard Henderson
2011-03-10  0:55   ` Michael Snyder
2011-03-10  2:19 ` Hans-Peter Nilsson
2011-03-10 18:27   ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).