mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 20:46:11 +02:00
BUG/MEDIUM: server: Allocate tmptrash before using it.
Don't forget to allocate tmptrash before using it, and free it once we're
done.
[wt: introduced by commit 64cc49cf ("MAJOR: servers: propagate server
status changes asynchronously"), no backport needed]
This commit is contained in:
parent
f08137c434
commit
796a2b3324
21
src/server.c
21
src/server.c
@ -4655,16 +4655,21 @@ void srv_update_status(struct server *s)
|
||||
}
|
||||
|
||||
if (s->cur_state == SRV_ST_STOPPED) { /* server was already down */
|
||||
chunk_printf(tmptrash,
|
||||
"%sServer %s/%s was DOWN and now enters maintenance%s%s%s",
|
||||
s->flags & SRV_F_BACKUP ? "Backup " : "", s->proxy->id, s->id,
|
||||
*(s->adm_st_chg_cause) ? " (" : "", s->adm_st_chg_cause, *(s->adm_st_chg_cause) ? ")" : "");
|
||||
tmptrash = alloc_trash_chunk();
|
||||
if (tmptrash) {
|
||||
chunk_printf(tmptrash,
|
||||
"%sServer %s/%s was DOWN and now enters maintenance%s%s%s",
|
||||
s->flags & SRV_F_BACKUP ? "Backup " : "", s->proxy->id, s->id,
|
||||
*(s->adm_st_chg_cause) ? " (" : "", s->adm_st_chg_cause, *(s->adm_st_chg_cause) ? ")" : "");
|
||||
|
||||
srv_append_status(tmptrash, s, NULL, -1, (s->next_admin & SRV_ADMF_FMAINT));
|
||||
srv_append_status(tmptrash, s, NULL, -1, (s->next_admin & SRV_ADMF_FMAINT));
|
||||
|
||||
if (!(global.mode & MODE_STARTING)) {
|
||||
Warning("%s.\n", tmptrash->str);
|
||||
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
|
||||
if (!(global.mode & MODE_STARTING)) {
|
||||
Warning("%s.\n", tmptrash->str);
|
||||
send_log(s->proxy, LOG_NOTICE, "%s.\n", tmptrash->str);
|
||||
}
|
||||
free_trash_chunk(tmptrash);
|
||||
tmptrash = NULL;
|
||||
}
|
||||
}
|
||||
else { /* server was still running */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user