INN commit: branches/2.4/nnrpd (python.c)

INN Commit Russ_Allbery at isc.org
Sun Jun 22 07:57:29 UTC 2008


    Date: Sunday, June 22, 2008 @ 00:57:28
  Author: iulius
Revision: 7887

Fix a segfault when one closes and then reopens Python in the same process.
files and dynamic_file are still pointing to the old freed memory and INN
blithely tries to write to it.
Thanks to Russ Allbery for the patch.

Modified:
  branches/2.4/nnrpd/python.c

----------+
 python.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Modified: python.c
===================================================================
--- python.c	2008-06-22 07:52:44 UTC (rev 7886)
+++ python.c	2008-06-22 07:57:28 UTC (rev 7887)
@@ -445,7 +445,9 @@
 
 
 /*
-**  This runs when nnrpd shuts down.
+**  This runs when nnrpd shuts down.  If Python is closed and reopened
+**  in the same process, files and dynamic_file are reused so they
+**  must point to NULL.
 */
 void
 PY_close_python(void)
@@ -453,9 +455,12 @@
     if (files != NULL) {
 	hash_traverse(files, file_trav, NULL);
 	hash_free(files);
+        files = NULL;
     }
-    if (dynamic_file != NULL)
+    if (dynamic_file != NULL) {
 	free(dynamic_file);
+        dynamic_file = NULL;
+    }
 }
 
 /*



More information about the inn-committers mailing list