This is the mail archive of the insight@sources.redhat.com mailing list for the Insight 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]

[patch] gdb_eval cleanup


I checked in this simple patch to delete the mem_file and free allocated 
memory in gdb_eval().

-- 
Martin Hunt
GDB Engineer
Red Hat, Inc.

2002-05-15  Martin M. Hunt  <hunt@redhat.com>

	* generic/gdbtk-cmds.c (gdb_eval): For mem_file stuff, delete
	the file when done and free memory.
Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.37
diff -u -u -r1.37 gdbtk-cmds.c
--- gdbtk-cmds.c	2002/04/05 23:31:58	1.37
+++ gdbtk-cmds.c	2002/05/15 23:20:44
@@ -622,6 +622,7 @@
   value_ptr val;
   struct ui_file *stb;
   long dummy;
+  char *result;
 
   if (objc != 2 && objc != 3)
     {
@@ -638,10 +639,13 @@
 
   /* "Print" the result of the expression evaluation. */
   stb = mem_fileopen ();
+  make_cleanup_ui_file_delete (stb);
   val_print (VALUE_TYPE (val), VALUE_CONTENTS (val),
 	     VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
 	     stb, format, 0, 0, 0);
-  Tcl_SetObjResult (interp, Tcl_NewStringObj (ui_file_xstrdup (stb, &dummy), -1));
+  result = ui_file_xstrdup (stb, &dummy);
+  Tcl_SetObjResult (interp, Tcl_NewStringObj (result, -1));
+  xfree (result);
   result_ptr->flags |= GDBTK_IN_TCL_RESULT;
 
   do_cleanups (old_chain);

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