[Python-checkins] r46659 - python/branches/release24-maint/Modules/_bsddb.c

gregory.p.smith python-checkins at python.org
Mon Jun 5 02:40:39 CEST 2006


Author: gregory.p.smith
Date: Mon Jun  5 02:40:31 2006
New Revision: 46659

Modified:
   python/branches/release24-maint/Modules/_bsddb.c
Log:
fix potential use of uninitialized char ** to construct a list if log_archive
is called with the (unsupported and unexported in this version) flag DB_ARCH_REMOVE.

also fix a log_list memory leak on error return in the event that python can't create
a new list object.



Modified: python/branches/release24-maint/Modules/_bsddb.c
==============================================================================
--- python/branches/release24-maint/Modules/_bsddb.c	(original)
+++ python/branches/release24-maint/Modules/_bsddb.c	Mon Jun  5 02:40:31 2006
@@ -4125,7 +4125,7 @@
 {
     int flags=0;
     int err;
-    char **log_list_start, **log_list;
+    char **log_list = NULL;
     PyObject* list;
     PyObject* item = NULL;
 
@@ -4146,11 +4146,14 @@
 
     list = PyList_New(0);
     if (list == NULL) {
+        if (log_list)
+            free(log_list);
         PyErr_SetString(PyExc_MemoryError, "PyList_New failed");
         return NULL;
     }
 
     if (log_list) {
+        char **log_list_start;
         for (log_list_start = log_list; *log_list != NULL; ++log_list) {
             item = PyString_FromString (*log_list);
             if (item == NULL) {


More information about the Python-checkins mailing list