bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] : in debug mode, every eval causes double free of memory


From: Jan Chaloupka
Subject: Re: [bug-gawk] : in debug mode, every eval causes double free of memory
Date: Sat, 10 May 2014 17:05:50 -0400 (EDT)

$ valgrind ./gawk -f /dev/null --debug
==27151== Memcheck, a memory error detector
==27151== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==27151== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==27151== Command: ./gawk -f /dev/null --debug
==27151== 
gawk> eval ""
gawk> eval ""
gawk> eval "print \"Fixed\""
Fixed
gawk> quit
==27151== 
==27151== HEAP SUMMARY:
==27151==     in use at exit: 37,145 bytes in 114 blocks
==27151==   total heap usage: 249 allocs, 135 frees, 66,483 bytes allocated
==27151== 
==27151== LEAK SUMMARY:
==27151==    definitely lost: 0 bytes in 0 blocks
==27151==    indirectly lost: 0 bytes in 0 blocks
==27151==      possibly lost: 0 bytes in 0 blocks
==27151==    still reachable: 37,145 bytes in 114 blocks
==27151==         suppressed: 0 bytes in 0 blocks
==27151== Rerun with --leak-check=full to see details of leaked memory
==27151== 
==27151== For counts of detected and suppressed errors, rerun with: -v
==27151== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

Valgrind output is now clean, well done.

----- Original Message -----
From: "Aharon Robbins" <address@hidden>
To: address@hidden, address@hidden
Cc: address@hidden
Sent: Saturday, May 10, 2014 10:28:19 PM
Subject: Re: [bug-gawk] : in debug mode, every eval causes double free of memory

--------------------------
diff --git a/debug.c b/debug.c
index 32b308a..67ad56d 100644
--- a/debug.c
+++ b/debug.c
@@ -5567,14 +5567,12 @@ do_eval(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
        pop_context();  /* switch to prev context */
        free_context(ctxt, (ret_val != NULL));   /* free all instructions and 
optionally symbols */
 
-       /*
-        * May 2014:
-        * Don't do this. f points into the context we just released.
-        * Only showed up on Fedora 20 / Ubuntu 14.04.
-        *
-        * if (ret_val != NULL)
-        *      destroy_symbol(f);      // destroy "@eval"
-        */
+       if (ret_val != NULL) {
+               NODE *s = make_string("@eval", 5);
+
+               (void) assoc_remove(func_table, s);
+               unref(s);
+       }
 
        free_srcfile(the_source);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]