]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
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:33:05 +0000 (17:33 +0100)
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.

src/server.c

index 466da441b4b52a1b23aef87f29f61eec63952e29..6212a420ed534f9c7e8b10038256ee9f811454f2 100644 (file)
@@ -3616,7 +3616,7 @@ void apply_server_state(void)
 
                        srv_state_parse_line(mybuf, global_file_version, params, srv_params);
                        if (params[0] == NULL)
-                               continue;
+                               goto nextline;
 
                        /* bkname */
                        bkname = params[1];