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

src/pl/plpython/plpython.c

index 79203f1c0e0f798fb8108bbfb67a7808d5f3c5ab..d126d875e58765316762f7f23bd07c005b0c42aa 100644 (file)
@@ -2328,14 +2328,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