summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-26 20:45:47 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-26 20:45:47 (GMT)
commitf446d217089e61778c794023f38932e2c2798234 (patch)
treed405b8364200be84d492b4b3a2b63bf30161f782 /Modules
parentd4095d95f87010751ebc0b656a87f422ce5480ad (diff)
parent9ee5c37c8f8c4f35814453aecf5fdfd01dfa2781 (diff)
downloadcpython-f446d217089e61778c794023f38932e2c2798234.zip
cpython-f446d217089e61778c794023f38932e2c2798234.tar.gz
cpython-f446d217089e61778c794023f38932e2c2798234.tar.bz2
Issue #18559: Fix NULL pointer dereference error in _pickle module
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_pickle.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 4ba185d..af73a84 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -4836,9 +4836,10 @@ load_binget(UnpicklerObject *self)
value = _Unpickler_MemoGet(self, idx);
if (value == NULL) {
PyObject *key = PyLong_FromSsize_t(idx);
- if (!PyErr_Occurred())
+ if (key != NULL) {
PyErr_SetObject(PyExc_KeyError, key);
- Py_DECREF(key);
+ Py_DECREF(key);
+ }
return -1;
}
@@ -4861,9 +4862,10 @@ load_long_binget(UnpicklerObject *self)
value = _Unpickler_MemoGet(self, idx);
if (value == NULL) {
PyObject *key = PyLong_FromSsize_t(idx);
- if (!PyErr_Occurred())
+ if (key != NULL) {
PyErr_SetObject(PyExc_KeyError, key);
- Py_DECREF(key);
+ Py_DECREF(key);
+ }
return -1;
}