pgsql: Fix two low-probability memory leaks in regular expression parsi

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix two low-probability memory leaks in regular expression parsi
Дата
Msg-id E1X8BXL-00007E-Lz@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix two low-probability memory leaks in regular expression parsing.

If pg_regcomp failed after having invoked markst/cleanst, it would leak any
"struct subre" nodes it had created.  (We've already detected all regex
syntax errors at that point, so the only likely causes of later failure
would be query cancel or out-of-memory.)  To fix, make sure freesrnode
knows the difference between the pre-cleanst and post-cleanst cleanup
procedures.  Add some documentation of this less-than-obvious point.

Also, newlacon did the wrong thing with an out-of-memory failure from
realloc(), so that the previously allocated array would be leaked.

Both of these are pretty low-probability scenarios, but a bug is a bug,
so patch all the way back.

Per bug #10976 from Arthur O'Dwyer.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/8a817785adf34387dce3be4b9f2b201cc9ff835d

Modified Files
--------------
src/backend/regex/regcomp.c |   31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix two low-probability memory leaks in regular expression parsi
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix two low-probability memory leaks in regular expression parsi