[pypy-commit] cffi cffi-1.0: a leak

arigo noreply at buildbot.pypy.org
Sun Apr 26 15:19:30 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-1.0
Changeset: r1846:d708ab8e01c6
Date: 2015-04-26 15:20 +0200
http://bitbucket.org/cffi/cffi/changeset/d708ab8e01c6/

Log:	a leak

diff --git a/_cffi1/realize_c_type.c b/_cffi1/realize_c_type.c
--- a/_cffi1/realize_c_type.c
+++ b/_cffi1/realize_c_type.c
@@ -657,6 +657,7 @@
                 break;
 
             default:
+                Py_DECREF(fields);
                 PyErr_Format(PyExc_NotImplementedError, "field op=%d",
                              (int)_CFFI_GETOP(op));
                 return -1;
@@ -671,8 +672,10 @@
             else if (detect_custom_layout(ct, SF_STD_FIELD_POS,
                                      ctf->ct_size, fld->field_size,
                                      "wrong size for field '",
-                                     fld->name, "'") < 0)
+                                     fld->name, "'") < 0) {
+                Py_DECREF(fields);
                 return -1;
+            }
 
             f = Py_BuildValue("(sOin)", fld->name, ctf,
                               fbitsize, (Py_ssize_t)fld->field_offset);


More information about the pypy-commit mailing list