summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-03-07 14:13:17 (GMT)
committerThomas Wouters <thomas@python.org>2006-03-07 14:13:17 (GMT)
commit098f6943c041f3d6ac42f1eb9b178df3bf43a383 (patch)
treead77fe8a127a1431d08602aa9d064e2ef82de8df /Modules
parenta74a84d4cbda0fcfe8c62422ccf98efae6298054 (diff)
downloadcpython-098f6943c041f3d6ac42f1eb9b178df3bf43a383.zip
cpython-098f6943c041f3d6ac42f1eb9b178df3bf43a383.tar.gz
cpython-098f6943c041f3d6ac42f1eb9b178df3bf43a383.tar.bz2
Coverity found bug: test result of PyTuple_New() against NULL before use.
Will backport.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_bsddb.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index 8f8eab2..f938ff0 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) {