summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-04-16 19:52:45 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-04-16 19:52:45 (GMT)
commit538ba2afb56414f96ad876d4fae0ae25c0019df8 (patch)
tree6645a8aad52ff279852212be068158e0d892932e
parentde3c73b57c783e0dac6233960be12629c446529c (diff)
downloadcpython-538ba2afb56414f96ad876d4fae0ae25c0019df8.zip
cpython-538ba2afb56414f96ad876d4fae0ae25c0019df8.tar.gz
cpython-538ba2afb56414f96ad876d4fae0ae25c0019df8.tar.bz2
Fix a refleak
-rw-r--r--Python/import.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index bd0d18a..a71bc37 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2782,10 +2782,11 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
}
base = PyUnicode_Substring(package, 0, last_dot);
if (PyUnicode_GET_LENGTH(name) > 0) {
- PyObject *borrowed_dot = NULL;
- PyObject *seq = PyTuple_Pack(2, base, name);
+ PyObject *borrowed_dot, *seq = NULL;
borrowed_dot = _PyUnicode_FromId(&single_dot);
+ seq = PyTuple_Pack(2, base, name);
+ Py_DECREF(base);
if (borrowed_dot == NULL || seq == NULL) {
goto error;
}