]> granicus.if.org Git - python/commitdiff
Fix a leak that would happen under error conditions (found by Coverty).
authorThomas Heller <theller@ctypes.org>
Thu, 16 Mar 2006 20:02:36 +0000 (20:02 +0000)
committerThomas Heller <theller@ctypes.org>
Thu, 16 Mar 2006 20:02:36 +0000 (20:02 +0000)
Modules/_ctypes/cfield.c

index 336f26543f63b76b4350b4da00ec0377dae9bc05..2816a6a2ab1e7fad2185fa5f602afad1d9dbd8c9 100644 (file)
@@ -1317,6 +1317,7 @@ Z_set(void *ptr, PyObject *value, unsigned size)
                if (-1 == PyUnicode_AsWideChar((PyUnicodeObject *)value,
                                               buffer, PyUnicode_GET_SIZE(value))) {
                        Py_DECREF(value);
+                       Py_DECREF(keep);
                        return NULL;
                }
                Py_DECREF(value);