unchecked malloc - Mailing list pgsql-hackers

From Qingqing Zhou
Subject unchecked malloc
Date
Msg-id dhahqs$90r$1@news.hub.org
Whole thread Raw
Responses Re: unchecked malloc
List pgsql-hackers
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











pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: State of support for back PG branches
Next
From: "Joshua D. Drake"
Date:
Subject: Re: State of support for back PG branches