There is IMHO a memleak in PromoteToGlobal(). Here is a fix:

Bert

---

 source/interpret.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --quilt old/source/interpret.c new/source/interpret.c
--- old/source/interpret.c
+++ new/source/interpret.c
@@ -760,11 +760,10 @@ Symbol *InstallSymbol(const char *name, 
 ** list.
 */
 Symbol *PromoteToGlobal(Symbol *sym)
 {
     Symbol *s;
-    static DataValue noValue = {NO_TAG, {0}};
 
     if (sym->type != LOCAL_SYM)
        return sym;
 
     /* Remove sym from the local symbol list */
@@ -780,11 +779,16 @@ Symbol *PromoteToGlobal(Symbol *sym)
     }
     
     s = LookupSymbol(sym->name);
     if (s != NULL)
        return s;
-    return InstallSymbol(sym->name, GLOBAL_SYM, noValue);
+
+    sym->type = GLOBAL_SYM;
+    sym->next = GlobalSymList;
+    GlobalSymList = sym;
+
+    return sym;
 }
 
 /*
 ** Allocate memory for a string, and keep track of it, such that it
 ** can be recovered later using GarbageCollectStrings.  (A linked list
-- 
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop

Reply via email to