Fix PL/Python memory leak involving array slices
authorAlvaro Herrera <[email protected]>
Thu, 17 Mar 2011 15:49:38 +0000 (12:49 -0300)
committerAlvaro Herrera <[email protected]>
Thu, 17 Mar 2011 15:49:38 +0000 (12:49 -0300)
Report and patch from Daniel Popowich, bug #5842
(with some debugging help from Alex Hunsaker)

src/pl/plpython/plpython.c

index ebb8023fc0d1e992431e03b161a1a93f1ccd3729..411db19eebb7a8d3098d9208f265df06fe23411f 100644 (file)
@@ -2280,14 +2280,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