mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-01-04 00:11:01 +01:00
BUG/MEDIUM: server: fix possibly uninitialized state file on close
Previous fix dc6e8a9a7 ("BUG/MEDIUM: server: resolve state file handle
leak on reload") traded a bug for another one, now we get this warning
when building server.c, which is valid since f is not necessarily
initialized (e.g. if no global state file is passed):
src/server.c: In function 'apply_server_state':
src/server.c:3272:3: warning: 'f' may be used uninitialized in this function [-Wmaybe-uninitialized]
fclose(f);
^~~~~~~~~
Let's initialize it first. This whole code block should really be
splitted, cleaned up and reorganized as it's possible that other
similar bugs are hidden in it.
This must be backported to the same branches the commit above is
backported to (likely 2.2 and 2.1).
This commit is contained in:
parent
dc6e8a9a7b
commit
2d067f93fb
@ -3162,7 +3162,7 @@ void apply_server_state(void)
|
||||
struct state_line *st;
|
||||
struct ebmb_node *node, *next_node;
|
||||
|
||||
|
||||
f = NULL;
|
||||
global_file_version = 0;
|
||||
globalfilepathlen = 0;
|
||||
/* create the globalfilepath variable */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user