BUG/MINOR: server: set rid default value in new_server()
srv->rid default value is set in _srv_parse_init() after the server is succesfully allocated using new_server(). This is wrong because new_server() can be used independently so rid value assignment would be skipped in this case. Hopefully new_server() allocates server data using calloc() so srv->rid is already set to 0 in practise. But if calloc() is replaced by malloc() or other memory allocating function that doesn't zero-initialize srv members, this could lead to rid being uninitialized in some cases. This should be backported in 2.8 with 61e3894dfe ("MINOR: server: add srv->rid (revision id) value")
This commit is contained in:
parent
9859e00981
commit
b2f7069479
@ -2430,6 +2430,7 @@ struct server *new_server(struct proxy *proxy)
|
||||
LIST_INIT(&srv->ip_rec_item);
|
||||
MT_LIST_INIT(&srv->prev_deleted);
|
||||
event_hdl_sub_list_init(&srv->e_subs);
|
||||
srv->rid = 0; /* rid defaults to 0 */
|
||||
|
||||
srv->next_state = SRV_ST_RUNNING; /* early server setup */
|
||||
srv->last_change = ns_to_sec(now_ns);
|
||||
@ -2764,9 +2765,6 @@ static int _srv_parse_init(struct server **srv, char **args, int *cur_arg,
|
||||
else
|
||||
newsrv->tmpl_info.prefix = strdup(args[1]);
|
||||
|
||||
/* revision defaults to 0 */
|
||||
newsrv->rid = 0;
|
||||
|
||||
/* several ways to check the port component :
|
||||
* - IP => port=+0, relative (IPv4 only)
|
||||
* - IP: => port=+0, relative
|
||||
|
Loading…
x
Reference in New Issue
Block a user