Re: Missing checks when malloc returns NULL...
От | Tom Lane |
---|---|
Тема | Re: Missing checks when malloc returns NULL... |
Дата | |
Msg-id | 22563.1472480805@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Missing checks when malloc returns NULL... (Aleksander Alekseev <a.alekseev@postgrespro.ru>) |
Ответы |
Re: Missing checks when malloc returns NULL...
|
Список | pgsql-hackers |
Aleksander Alekseev <a.alekseev@postgrespro.ru> writes: >> if (prodesc->user_proname == NULL || prodesc->internal_proname == NULL) >> + { >> + free(prodesc); > I think that prodesc->user_proname and prodesc->internal_proname should > also be freed if they are not NULL's. Hmm, this is kind of putting lipstick on a pig, isn't it? That code is still prone to leakage further down, because it calls stuff like SearchSysCache which is entirely capable of throwing elog(ERROR). If we're going to touch compile_pltcl_function at all, I'd vote for (1) changing these malloc calls to MemoryContextAlloc(TopMemoryContext,... (2) putting the cleanup into a PG_CATCH block, and removing all the retail free() calls that are there now. regards, tom lane
В списке pgsql-hackers по дате отправления: