BUG/MINOR: state-file: do not leak memory on parse errors
authorWilly Tarreau <w@1wt.eu>
Fri, 20 Dec 2019 16:26:27 +0000 (17:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 20 Dec 2019 16:35:40 +0000 (17:35 +0100)
commit48c775b810097c78bf3d5bc40005757f733175d7
tree935c3cdd6966a8c8b024d3c38766b49a9efa4504
parent659d3b75b6f0f2908b0eaf78777579d47992d4dd
BUG/MINOR: state-file: do not leak memory on parse errors

Issue #417 reports a possible memory leak in the state-file loading code.
There's one such place in the loop which corresponds to parsing errors
where the curreently allocated line is not freed when dropped. In any
case this is very minor in that no more than the file's length may be
lost in the worst case, considering that the whole file is kept anyway
in case of success. This fix addresses this.

It should be backported to 2.1.

(cherry picked from commit ca7a5af664504cbe13240e5bc538efbcef4f6162)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/server.c