lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev [PATCH][dev25] statusline leakage


From: John Bley
Subject: lynx-dev [PATCH][dev25] statusline leakage
Date: Sun, 2 May 1999 19:34:18 -0400 (EDT)

* Register free_messages_stack with atexit to fix some statusline leakage, 
  explicitly fill out a struct initializer (John Bley)

(Had to move free_messages_stack up to do this, the struct thing is kinda 
random)

-- 
John Bley - address@hidden
Duke '99 - English/Computer Science
  Since English is a mess, it maps well onto the problem space,
  which is also a mess, which we call reality.     - Larry Wall

diff -Burp lynx2-8-2/src/LYHistory.c lynx2-8-2-patched/src/LYHistory.c
--- lynx2-8-2/src/LYHistory.c   Tue Apr 27 08:59:06 1999
+++ lynx2-8-2-patched/src/LYHistory.c   Sun May  2 19:24:35 1999
@@ -612,6 +612,20 @@ PUBLIC int LYShowVisitedLinks ARGS1(
 #define STATUSBUFSIZE   40
 PRIVATE char * buffstack[STATUSBUFSIZE];
 PRIVATE int topOfStack = 0;
+#ifdef LY_FIND_LEAKS
+PRIVATE int already_registered_free_messages_stack = 0;
+#endif
+
+#ifdef LY_FIND_LEAKS
+PRIVATE void free_messages_stack NOARGS
+{
+    topOfStack = STATUSBUFSIZE;
+
+    while (--topOfStack >= 0) {
+       FREE(buffstack[topOfStack]);
+    }
+}
+#endif
 
 PRIVATE void to_stack ARGS1(char *, str)
 {
@@ -628,18 +642,14 @@ PRIVATE void to_stack ARGS1(char *, str)
     FREE(buffstack[topOfStack]);
     buffstack[topOfStack] = str;
     topOfStack++;
-}
-
 #ifdef LY_FIND_LEAKS
-PRIVATE void free_messages_stack NOARGS
-{
-    topOfStack = STATUSBUFSIZE;
-
-    while (--topOfStack >= 0) {
-       FREE(buffstack[topOfStack]);
+    if(!already_registered_free_messages_stack) {
+       already_registered_free_messages_stack = 1;
+       atexit(free_messages_stack);
     }
-}
 #endif
+}
+
 
 /*
  *  Status line messages list, LYNXMESSAGES:/ internal page,
diff -Burp lynx2-8-2/src/LYReadCFG.c lynx2-8-2-patched/src/LYReadCFG.c
--- lynx2-8-2/src/LYReadCFG.c   Tue Apr 27 08:59:06 1999
+++ lynx2-8-2-patched/src/LYReadCFG.c   Sun May  2 19:00:09 1999
@@ -1177,7 +1177,7 @@ static Config_Type Config_Table [] =
      PARSE_ENV("wais_proxy", CONF_ENV, 0 ),
      PARSE_STR("xloadimage_command", CONF_STR, &XLoadImageCommand),
 
-     {0}
+     {0, 0, 0}
 };
 
 /*

reply via email to

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