This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RFA: fix a memory leak in value.c
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 06 Jan 2009 15:23:14 -0700
- Subject: RFA: fix a memory leak in value.c
- Reply-to: Tom Tromey <tromey at redhat dot com>
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);