]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: config: don't free valid regex memory
authorWilly Tarreau <w@1wt.eu>
Sun, 18 May 2014 06:11:41 +0000 (08:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 18 May 2014 06:11:41 +0000 (08:11 +0200)
commit63af98d0dd83b4b173fe7c6c632f0583b7cec497
treecf81c994fc3933a90bb1adb1182db59bfc678df2
parent07fcaaa4cd89002cb100644197752ea050f54bee
BUG/MAJOR: config: don't free valid regex memory

Thomas Heil reported that previous commit 07fcaaa ("MINOR: fix a few
memory usage errors") make haproxy crash when req* rules are used. As
diagnosed by Cyril Bonté, this commit introduced a regression which
makes haproxy free the memory areas allocated for regex even when
they're going to be used, resulting in the crashes.

This patch does three things :
  - undo the free() on the valid path
  - add regfree() on the error path but only when regcomp() succeeds
  - rename err_code to ret_code to avoid confusing the valid return
    path with an error path.
src/cfgparse.c