Andres Freund <and...@anarazel.de> writes:
> On Friday 30 April 2010 19:39:32 Tom Lane wrote:
>> Yeah.  There's a leak of the tuptable in the CATCH path, too.  Will fix.

> Yes, theres even more than that (measured it) in the error case. Will have a 
> look later today.

Here's the patch I'm planning to apply --- working it back into the
back branches now.

                        regards, tom lane


Index: plpython.c
===================================================================
RCS file: /cvsroot/pgsql/src/pl/plpython/plpython.c,v
retrieving revision 1.141
diff -c -r1.141 plpython.c
*** plpython.c  18 Mar 2010 19:43:03 -0000      1.141
--- plpython.c  30 Apr 2010 17:38:20 -0000
***************
*** 3147,3155 ****
  
                                        PyList_SetItem(result->rows, i, row);
                                }
-                               PLy_typeinfo_dealloc(&args);
- 
-                               SPI_freetuptable(tuptable);
                        }
                }
                PG_CATCH();
--- 3147,3152 ----
***************
*** 3160,3170 ****
                        if (!PyErr_Occurred())
                                PLy_exception_set(PLy_exc_error,
                                           "unrecognized error in 
PLy_spi_execute_fetch_result");
-                       Py_DECREF(result);
                        PLy_typeinfo_dealloc(&args);
                        return NULL;
                }
                PG_END_TRY();
        }
  
        return (PyObject *) result;
--- 3157,3171 ----
                        if (!PyErr_Occurred())
                                PLy_exception_set(PLy_exc_error,
                                           "unrecognized error in 
PLy_spi_execute_fetch_result");
                        PLy_typeinfo_dealloc(&args);
+                       SPI_freetuptable(tuptable);
+                       Py_DECREF(result);
                        return NULL;
                }
                PG_END_TRY();
+ 
+               PLy_typeinfo_dealloc(&args);
+               SPI_freetuptable(tuptable);
        }
  
        return (PyObject *) result;

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to