Ron Peterson <[EMAIL PROTECTED]> writes:
> On Thu, Jan 09, 2003 at 04:50:56PM -0500, Ron Peterson wrote:
>> colindices = (int *) malloc (ncols * sizeof (int));

> Of course we should verify that malloc succeeded...

Actually, the correct answer is "you should not be using malloc() in
backend functions".  You should be using palloc, or possibly
MemoryContextAlloc, either of which will elog if it can't get space.

> if (colindices == NULL) {
>       elog (ERROR, "noupcol: malloc failed\n");
>       SPI_finish();
>       return PointerGetDatum (NULL);
> }

This is even more pointless.  Control does not return from elog(ERROR),
so the two following lines are dead code.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to