diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-10-16 03:12:39 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-10-16 03:12:39 (GMT) |
commit | 294a9fcba67b95efc62c5461fcc6fe9a5a59c525 (patch) | |
tree | c9bded2255081bc40ff2ee1f1702a07e09e60e9a /Python | |
parent | f6219a588dd405583d7ee92ac51be31dd7b131c8 (diff) | |
download | cpython-294a9fcba67b95efc62c5461fcc6fe9a5a59c525.zip cpython-294a9fcba67b95efc62c5461fcc6fe9a5a59c525.tar.gz cpython-294a9fcba67b95efc62c5461fcc6fe9a5a59c525.tar.bz2 |
fix refleak
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c index 94363de..5a09c97 100644 --- a/Python/import.c +++ b/Python/import.c @@ -3462,7 +3462,7 @@ imp_cache_from_source(PyObject *self, PyObject *args, PyObject *kws) char buf[MAXPATHLEN+1]; PyObject *pathbytes; char *cpathname; - PyObject *debug_override = Py_None; + PyObject *debug_override = NULL; int debug = !Py_OptimizeFlag; if (!PyArg_ParseTupleAndKeywords( @@ -3470,9 +3470,11 @@ imp_cache_from_source(PyObject *self, PyObject *args, PyObject *kws) PyUnicode_FSConverter, &pathbytes, &debug_override)) return NULL; - if (debug_override != Py_None) - if ((debug = PyObject_IsTrue(debug_override)) < 0) - return NULL; + if (debug_override != NULL && + (debug = PyObject_IsTrue(debug_override)) < 0) { + Py_DECREF(pathbytes); + return NULL; + } cpathname = make_compiled_pathname( PyBytes_AS_STRING(pathbytes), |