From: Gregory P. Smith Date: Mon, 5 Jun 2006 00:40:31 +0000 (+0000) Subject: fix potential use of uninitialized char ** to construct a list if log_archive X-Git-Tag: v2.4.4c1~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee6ca70548f6abf1ea337cd358bf1ace2df0af1a;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index e146b4950034..3684bfdce3ce 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -4125,7 +4125,7 @@ DBEnv_log_archive(DBEnvObject* self, PyObject* args) { int flags=0; int err; - char **log_list_start, **log_list; + char **log_list = NULL; PyObject* list; PyObject* item = NULL; @@ -4146,11 +4146,14 @@ DBEnv_log_archive(DBEnvObject* self, PyObject* args) 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) {