This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA: fix a memory leak in value.c


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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]