From: Thomas Wouters Date: Tue, 7 Mar 2006 14:13:17 +0000 (+0000) Subject: Coverity found bug: test result of PyTuple_New() against NULL before use. X-Git-Tag: v2.5a0~337 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=098f6943c041f3d6ac42f1eb9b178df3bf43a383;p=thirdparty%2FPython%2Fcpython.git Coverity found bug: test result of PyTuple_New() against NULL before use. Will backport. --- diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 8f8eab24c348..f938ff044cbb 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -1084,12 +1084,12 @@ _db_associateCallback(DB* db, const DBT* priKey, const DBT* priData, } data = PyString_FromStringAndSize(priData->data, priData->size); args = PyTuple_New(2); - PyTuple_SET_ITEM(args, 0, key); /* steals reference */ - PyTuple_SET_ITEM(args, 1, data); /* steals reference */ - - result = PyEval_CallObject(callback, args); - - if (result == NULL) { + if (args != NULL) { + PyTuple_SET_ITEM(args, 0, key); /* steals reference */ + PyTuple_SET_ITEM(args, 1, data); /* steals reference */ + result = PyEval_CallObject(callback, args); + } + if (args == NULL || result == NULL) { PyErr_Print(); } else if (result == Py_None) {