summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/_pickle.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 5d9ee8c..dc0ef0a 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -1962,9 +1962,11 @@ whichmodule(PickleState *st, PyObject *global, PyObject *global_name, PyObject *
PyErr_Format(st->PicklingError,
"Can't pickle %R: import of module %R failed",
global, module_name);
+ Py_DECREF(module_name);
return NULL;
}
if (check_dotted_path(module, global_name, dotted_path) < 0) {
+ Py_DECREF(module_name);
Py_DECREF(module);
return NULL;
}
@@ -1974,6 +1976,7 @@ whichmodule(PickleState *st, PyObject *global, PyObject *global_name, PyObject *
PyErr_Format(st->PicklingError,
"Can't pickle %R: attribute lookup %S on %S failed",
global, global_name, module_name);
+ Py_DECREF(module_name);
return NULL;
}
if (actual != global) {
@@ -1981,6 +1984,7 @@ whichmodule(PickleState *st, PyObject *global, PyObject *global_name, PyObject *
PyErr_Format(st->PicklingError,
"Can't pickle %R: it's not the same object as %S.%S",
global, module_name, global_name);
+ Py_DECREF(module_name);
return NULL;
}
Py_DECREF(actual);