BUG/MINOR: sink: fix errors handling in cfg_post_parse_ring()

Multiple error paths (memory,IO related) in cfg_post_parse_ring() were
not implemented correcly and could result in memory leak or undefined
behavior.

Fixing them all at once.

This can be backported in 2.4
This commit is contained in:
Aurelien DARRAGON 2023-07-10 16:26:08 +02:00 committed by Christopher Faulet
parent a26b736300
commit 9859e00981

View File

@ -1223,11 +1223,16 @@ int cfg_post_parse_ring()
if (!ring_attach(cfg_sink->ctx.ring)) {
ha_alert("server '%s' sets too many watchers > 255 on ring '%s'.\n", srv->id, cfg_sink->name);
err_code |= ERR_ALERT | ERR_FATAL;
ha_free(&sft);
break;
}
cfg_sink->sft = sft;
srv = srv->next;
}
sink_init_forward(cfg_sink);
if (sink_init_forward(cfg_sink) == 0) {
ha_alert("error when trying to initialize sink buffer forwarding.\n");
err_code |= ERR_ALERT | ERR_FATAL;
}
}
}
cfg_sink = NULL;