There are several places in both backend and tools that forget to check the 
return value of malloc(). For example(8.0.1),

    backend/port/dynloader/beos.c/pg_dlopen()
    backend/bootstrap/bootstrap.c/AddStr()
    port/strdup.c/strdup()
    bin/pg_dump/common.c/findParentsByOid()
    ...

I am thinking we should fix them. Basically we have two ways, one is to 
define a pg_malloc() as psql already did, the other is to fix these places 
one by one. I prefer the first method, since it hides the return value check 
details in the function and less error proning. To report the "out of 
memory" error, we should differenciate if ErrorContext is already set up.

Comments?

Regards,
Qingqing










---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to