mirror of
https://github.com/python/cpython.git
synced 2024-12-04 23:34:42 +08:00
Coverity found bug: test result of PyTuple_New() against NULL before use.
Will backport.
This commit is contained in:
parent
a74a84d4cb
commit
098f6943c0
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user