BUG/MEDIUM: server: resolve state file handle leak on reload

During reload, server state file is read and file handle is not released
this was indepently reported in #738 and #660.

partially resolves #660. This should be backported to 2.2 and 2.1.
This commit is contained in:
Ilya Shipitsin 2020-07-16 02:02:40 +05:00 committed by Willy Tarreau
parent b605a736b0
commit dc6e8a9a7b

View File

@ -3268,6 +3268,11 @@ void apply_server_state(void)
}
out_load_server_state_in_tree:
if (f) {
fclose(f);
f = NULL;
}
/* parse all proxies and load states form tree (global file) or from local file */
for (curproxy = proxies_list; curproxy != NULL; curproxy = curproxy->next) {
/* servers are only in backends */
@ -3447,9 +3452,11 @@ void apply_server_state(void)
/* now we can proceed with server's state update */
srv_update_state(srv, version, srv_params);
}
fileclose:
fclose(f);
}
fileclose:
fclose(f);
}
/* now free memory allocated for the tree */