From c1f476744e908d1f6e28be8059cee1fe72ec1fec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Sun, 2 Nov 2008 20:57:58 +0100
Subject: [PATCH] Fixed fatal "got invalid pointer" during cleanup of ADT.List
 on exit. Added some FIXMEs regarding names of lambda functions.

Rev: src/builtin.cmod:1.226
Rev: src/module.c:1.59
---
 src/builtin.cmod | 13 ++++++++++++-
 src/module.c     |  3 ++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/builtin.cmod b/src/builtin.cmod
index 13dab2efe0..3e6d1297c8 100644
--- a/src/builtin.cmod
+++ b/src/builtin.cmod
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: builtin.cmod,v 1.225 2008/10/04 18:31:12 mast Exp $
+|| $Id: builtin.cmod,v 1.226 2008/11/02 19:57:58 grubba Exp $
 */
 
 #include "global.h"
@@ -1019,10 +1019,15 @@ PIKEFUN string function_name(program|function func)
       {
 	struct pike_trampoline *t;
 	t=((struct pike_trampoline *)func->u.object->storage);
+
+	/* FIXME: Adjust lambda names. */
+      
 	if(t->frame->current_object->prog)
 	  REF_RETURN ID_FROM_INT(t->frame->current_object->prog,
 				 t->func)->name;
       }
+
+      /* FIXME: Adjust lambda names. */
       
       REF_RETURN ID_FROM_INT(func->u.object->prog, func->subtype)->name;
   }
@@ -3981,7 +3986,13 @@ void init_builtin(void)
 void exit_builtin(void)
 {
   EXIT
+#ifndef DO_PIKE_CLEANUP
+  /* This is performed by exit_builtin_modules() at a later point
+   * in this case, so that the pike_list_node's are valid at cleanup
+   * time, thus avoiding "got invalid pointer" fatals at exit.
+   */
   free_all_pike_list_node_blocks();
+#endif
 #ifndef USE_SETENV
   if (env_allocs) free_mapping (env_allocs);
 #endif
diff --git a/src/module.c b/src/module.c
index 752d8f279a..52c9ba3ae6 100644
--- a/src/module.c
+++ b/src/module.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: module.c,v 1.58 2008/08/05 21:43:26 mast Exp $
+|| $Id: module.c,v 1.59 2008/11/02 19:57:58 grubba Exp $
 */
 
 #include "global.h"
@@ -153,6 +153,7 @@ static void exit_builtin_modules(void)
    * THREADS_ALLOW/DISALLOW are NOPs beyond this point. */
   th_cleanup();
 #endif
+  free_all_pike_list_node_blocks();
 
   exit_pike_security();
   free_svalue(& throw_value);
-- 
GitLab