Author: guido.van.rossum
Date: Mon Nov  5 22:50:58 2007
New Revision: 58867

Modified:
   python/branches/py3k-pep3137/Modules/_struct.c
Log:
Add missing PyObject_ReleaseBuffer() calls in error paths.
Alas, this doesn't fix the leaks reported in issue 1389.


Modified: python/branches/py3k-pep3137/Modules/_struct.c
==============================================================================
--- python/branches/py3k-pep3137/Modules/_struct.c      (original)
+++ python/branches/py3k-pep3137/Modules/_struct.c      Mon Nov  5 22:50:58 2007
@@ -1544,6 +1544,7 @@
                PyErr_Format(StructError,
                             "unpack requires a bytes argument of length %zd",
                             soself->s_size);
+                PyObject_ReleaseBuffer(input, &vbuf);
                return NULL;
        }
        result = s_unpack_internal(soself, vbuf.buf);
@@ -1585,6 +1586,7 @@
                PyErr_Format(StructError,
                        "unpack_from requires a buffer of at least %zd bytes",
                        soself->s_size);
+                PyObject_ReleaseBuffer(input, &vbuf);
                return NULL;
        }
        result = s_unpack_internal(soself, (char*)vbuf.buf + offset);
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to