]> granicus.if.org Git - python/commitdiff
getbuffer(): release the buffer on error (if the buffer is not contiguous)
authorVictor Stinner <victor.stinner@haypocalc.com>
Thu, 24 Jun 2010 22:57:10 +0000 (22:57 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Thu, 24 Jun 2010 22:57:10 +0000 (22:57 +0000)
Python/getargs.c

index ab95e1e547b82ed8ce665510149c9e3a410db9ff..41b4af56cf472d60ebebaa944e7924387a5c8b71 100644 (file)
@@ -1340,6 +1340,7 @@ getbuffer(PyObject *arg, Py_buffer *view, char **errmsg)
         return -1;
     }
     if (!PyBuffer_IsContiguous(view, 'C')) {
+        PyBuffer_Release(view);
         *errmsg = "contiguous buffer";
         return -1;
     }