]> granicus.if.org Git - postgresql/commitdiff
Fix PL/Python memory leak involving array slices
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 17 Mar 2011 15:28:46 +0000 (12:28 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 17 Mar 2011 18:26:15 +0000 (15:26 -0300)
Report and patch from Daniel Popowich, bug #5842
(with some debugging help from Alex Hunsaker)

src/pl/plpython/plpython.c

index 1f8c27f632a994e68c4f5e9a98678d4a9c00feaa..dd2b9190fca757068360fcaaff3cf0e752648309 100644 (file)
@@ -3201,14 +3201,9 @@ PLy_result_ass_item(PyObject *arg, Py_ssize_t idx, PyObject *item)
 static PyObject *
 PLy_result_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx)
 {
-       PyObject   *rv;
        PLyResultObject *ob = (PLyResultObject *) arg;
 
-       rv = PyList_GetSlice(ob->rows, lidx, hidx);
-       if (rv == NULL)
-               return NULL;
-       Py_INCREF(rv);
-       return rv;
+       return PyList_GetSlice(ob->rows, lidx, hidx);
 }
 
 static int