mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-18 17:34:45 +00:00
BUG/MINOR: sink: invalid sft free in sink_deinit()
sft freeing attempt made ina575421
("BUG/MINOR: sink: missing sft free in sink_deinit()") is incomplete, because sink->sft is meant to be used as a list and not a single sft entry. Because of that, the previous fix only frees the first sft entry, which fixes memory leaks for single-server forwarders (this is the case for implicit rings), but could still result in memory leaks when multiple servers are configured in a explicit ring sections. What this patch does: instead of directly freeing sink->sft, it iterates over every list members to free them. It must be backported up to 2.4 witha575421
.
This commit is contained in:
parent
9f9d557468
commit
a26b736300
@ -1356,6 +1356,7 @@ static void sink_init()
|
||||
static void sink_deinit()
|
||||
{
|
||||
struct sink *sink, *sb;
|
||||
struct sink_forward_target *sft_next;
|
||||
|
||||
list_for_each_entry_safe(sink, sb, &sink_list, sink_list) {
|
||||
if (sink->type == SINK_TYPE_BUFFER) {
|
||||
@ -1375,7 +1376,11 @@ static void sink_deinit()
|
||||
free_proxy(sink->forward_px);
|
||||
free(sink->name);
|
||||
free(sink->desc);
|
||||
free(sink->sft);
|
||||
while (sink->sft) {
|
||||
sft_next = sink->sft->next;
|
||||
free(sink->sft);
|
||||
sink->sft = sft_next;
|
||||
}
|
||||
free(sink);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user