Fix bug introduced in recent patch to make plpython cope with OUT arguments:
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 4 Nov 2008 15:16:48 +0000 (15:16 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 4 Nov 2008 15:16:48 +0000 (15:16 +0000)
the proc->argnames array has to be initialized to zero immediately on creation,
since the error recovery path will try to free its elements.

src/pl/plpython/plpython.c

index b732ac5427c60c9f380af338aff54bfebc600a7f..1e136b22c64a7ddb2a2609cbd61788a06bfa2da4 100644 (file)
@@ -1,7 +1,7 @@
 /**********************************************************************
  * plpython.c - python as a procedural language for PostgreSQL
  *
- *     $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.115 2008/11/02 01:45:28 tgl Exp $
+ *     $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.116 2008/11/04 15:16:48 tgl Exp $
  *
  *********************************************************************
  */
@@ -1282,7 +1282,7 @@ PLy_procedure_create(HeapTuple procTup, Oid tgreloid, char *key)
                                }
                        }
 
-                       proc->argnames = (char **) PLy_malloc(sizeof(char *) * proc->nargs);
+                       proc->argnames = (char **) PLy_malloc0(sizeof(char *) * proc->nargs);
                        for (i = pos = 0; i < total; i++)
                        {
                                HeapTuple       argTypeTup;