diff Python/import.c @ 76361:a3e9d5c239c4

Fix a refleak
author Antoine Pitrou <solipsis@pitrou.net>
date Mon, 16 Apr 2012 21:52:45 +0200
parents feeb1ca9e93c
children 9d8839289e18
line wrap: on
line diff
--- a/Python/import.c	Mon Apr 16 21:29:58 2012 +0200
+++ b/Python/import.c	Mon Apr 16 21:52:45 2012 +0200
@@ -2782,10 +2782,11 @@
         }
         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;
             }