Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: fix a memory leak in value.c
@ 2009-01-06 22:23 Tom Tromey
  2009-01-06 23:29 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2009-01-06 22:23 UTC (permalink / raw)
  To: gdb-patches

This patch fixes a small memory leak in value.c.

After the content-allocation change, values must be freed using
value_free, not xfree.

Built and regtested on x86-64 (compile farm).
Verified with valgrind.

Please review.

thanks,
Tom

2009-01-06  Tom Tromey  <tromey@redhat.com>

	* value.c (set_internalvar): Use value_free, not xfree.

diff --git a/gdb/value.c b/gdb/value.c
index 39df98e..1068f1d 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -931,7 +931,7 @@ set_internalvar (struct internalvar *var, struct value *val)
      something in the value chain (i.e., before release_value is
      called), because after the error free_all_values will get called before
      long.  */
-  xfree (var->value);
+  value_free (var->value);
   var->value = newval;
   var->endian = gdbarch_byte_order (current_gdbarch);
   release_value (newval);


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

* Re: RFA: fix a memory leak in value.c
  2009-01-06 22:23 RFA: fix a memory leak in value.c Tom Tromey
@ 2009-01-06 23:29 ` Daniel Jacobowitz
  2009-01-07  0:47   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2009-01-06 23:29 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Tue, Jan 06, 2009 at 03:23:14PM -0700, Tom Tromey wrote:
> This patch fixes a small memory leak in value.c.
> 
> After the content-allocation change, values must be freed using
> value_free, not xfree.
> 
> Built and regtested on x86-64 (compile farm).
> Verified with valgrind.
> 
> Please review.

OK, thanks.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: RFA: fix a memory leak in value.c
  2009-01-06 23:29 ` Daniel Jacobowitz
@ 2009-01-07  0:47   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2009-01-07  0:47 UTC (permalink / raw)
  To: gdb-patches

>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

>> After the content-allocation change, values must be freed using
>> value_free, not xfree.

Daniel> OK, thanks.

Thanks, I've checked this in.

Tom


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

end of thread, other threads:[~2009-01-07  0:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-06 22:23 RFA: fix a memory leak in value.c Tom Tromey
2009-01-06 23:29 ` Daniel Jacobowitz
2009-01-07  0:47   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox