Fix a resource leak (src/backend/utils/adt/rowtypes.c)

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Fix a resource leak (src/backend/utils/adt/rowtypes.c)
Дата
Msg-id CAEudQApNjhD49jjjPpu0ykG+qLVMQdMa_SBPn9yXhAPL0E4__Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: Fix a resource leak (src/backend/utils/adt/rowtypes.c)
Список pgsql-hackers
Hi.

Per Coverity.

CID 1608916: (#1 of 1): Resource leak (RESOURCE_LEAK)
52. leaked_storage: Variable buf going out of scope leaks the storage buf.data points to. 

The function *record_in* has a new report about resource leak.
I think Coverity is right.
The normal path of the function frees the memory of several variables used.
Therefore the failure path should also free them.
A quick search on the web shows several occurrences of "malformed record literal", therefore failure is common in this function.

Although Coveriy reports the leak of only buf.data, the variables *values* and *nulls* should also be released.

While there, move the creation of stringdata, to ensure that in case of failure, the buf.data variable is released correctly.

Attached a path.

best regards,
Ranier Vilela

Вложения

В списке pgsql-hackers по дате отправления: