Fix bug introduced in recent patch to make plpython cope with OUT arguments:
authorTom Lane <[email protected]>
Tue, 4 Nov 2008 15:16:48 +0000 (15:16 +0000)
committerTom Lane <[email protected]>
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 273aec02d741c8b4e827a2f2193d4373fa489891..1565c41372fd66c9ea8303df4511c16dddd475a1 100644 (file)
@@ -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;