MINOR: cli: use srv_drop() when server was created using new_server()

Now that new_server() is becoming more and more complex, we need to
take care that servers created using new_server() must be released
using the corresponding release function srv_drop() which takes care
of properly de-initing the server and its members.
This commit is contained in:
Aurelien DARRAGON 2026-01-13 19:37:54 +01:00
parent eebb448f49
commit 12dc9325a7
2 changed files with 3 additions and 6 deletions

View File

@ -3737,11 +3737,8 @@ int mworker_cli_attach_server(char **errmsg)
error:
list_for_each_entry(child, &proc_list, list) {
free((char *)child->srv->conf.file); /* cast because of const char * */
free(child->srv->id);
srv_free(&child->srv);
}
list_for_each_entry(child, &proc_list, list)
srv_drop(child->srv);
free(msg);
return -1;

View File

@ -3434,7 +3434,7 @@ static int _srv_parse_tmpl_init(struct server *srv, struct proxy *px)
free_check(&newsrv->check);
MT_LIST_DELETE(&newsrv->global_list);
}
srv_free(&newsrv);
srv_drop(newsrv);
return i - srv->tmpl_info.nb_low;
}