Commit 48492d84 authored by Thomas Wouters's avatar Thomas Wouters

Coverity found bug: test result of PyTuple_New() against NULL before use.

Will backport.
parent 977f82ed
...@@ -1084,12 +1084,12 @@ _db_associateCallback(DB* db, const DBT* priKey, const DBT* priData, ...@@ -1084,12 +1084,12 @@ _db_associateCallback(DB* db, const DBT* priKey, const DBT* priData,
} }
data = PyString_FromStringAndSize(priData->data, priData->size); data = PyString_FromStringAndSize(priData->data, priData->size);
args = PyTuple_New(2); args = PyTuple_New(2);
if (args != NULL) {
PyTuple_SET_ITEM(args, 0, key); /* steals reference */ PyTuple_SET_ITEM(args, 0, key); /* steals reference */
PyTuple_SET_ITEM(args, 1, data); /* steals reference */ PyTuple_SET_ITEM(args, 1, data); /* steals reference */
result = PyEval_CallObject(callback, args); result = PyEval_CallObject(callback, args);
}
if (result == NULL) { if (args == NULL || result == NULL) {
PyErr_Print(); PyErr_Print();
} }
else if (result == Py_None) { else if (result == Py_None) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment