]> granicus.if.org Git - postgresql/commitdiff
Fix leakage of proc-related storage in plpython's inline handler.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 1 May 2010 17:04:38 +0000 (17:04 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 1 May 2010 17:04:38 +0000 (17:04 +0000)
Per report from Andres Freund.

src/pl/plpython/plpython.c

index e4c32eb33a3f21ac5152e37d10ce18b04dc29cf1..7ddc223dfd4ab75618434e293cd82a9b3c044361 100644 (file)
@@ -1,7 +1,7 @@
 /**********************************************************************
  * plpython.c - python as a procedural language for PostgreSQL
  *
- *     $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.142 2010/04/30 19:15:45 tgl Exp $
+ *     $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.143 2010/05/01 17:04:38 tgl Exp $
  *
  *********************************************************************
  */
@@ -541,12 +541,15 @@ plpython_inline_handler(PG_FUNCTION_ARGS)
        }
        PG_CATCH();
        {
+               PLy_procedure_delete(proc);
                PLy_curr_procedure = save_curr_proc;
                PyErr_Clear();
                PG_RE_THROW();
        }
        PG_END_TRY();
 
+       PLy_procedure_delete(proc);
+
        /* Pop the error context stack */
        error_context_stack = plerrcontext.previous;
 
@@ -1664,6 +1667,7 @@ PLy_procedure_delete(PLyProcedure *proc)
        }
        if (proc->argnames)
                PLy_free(proc->argnames);
+       PLy_free(proc);
 }
 
 /*