unchecked malloc

Поиск
Список
Период
Сортировка
От Qingqing Zhou
Тема unchecked malloc
Дата
Msg-id dhahqs$90r$1@news.hub.org
обсуждение исходный текст
Ответы Re: unchecked malloc  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: State of support for back PG branches
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: State of support for back PG branches