diff options
author | Thomas Wouters <thomas@python.org> | 2006-03-07 14:16:02 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-03-07 14:16:02 (GMT) |
commit | 82735da0165cc8b0b080d7e28d4123c3168c4cf7 (patch) | |
tree | 4bb2722f27f0e8606bfed96af21364b97a520015 /Modules | |
parent | d704935378090a9e4a8e9f9ddfa11ab091ed7db3 (diff) | |
download | cpython-82735da0165cc8b0b080d7e28d4123c3168c4cf7.zip cpython-82735da0165cc8b0b080d7e28d4123c3168c4cf7.tar.gz cpython-82735da0165cc8b0b080d7e28d4123c3168c4cf7.tar.bz2 |
Backport trunk's r42890 (thomas.wouters):
Coverity found bug: test result of PyTuple_New() against NULL before use.
and r42891 (thomas.wouters):
Fix gcc 4.0.x warning about use of uninitialized value.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_bsddb.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 07c56cd..de072b0 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -1063,7 +1063,7 @@ _db_associateCallback(DB* db, const DBT* priKey, const DBT* priData, PyObject* key; PyObject* data; PyObject* args; - PyObject* result; + PyObject* result = NULL; if (callback != NULL) { @@ -1077,12 +1077,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) { |