Skip to content

Commit

Permalink
out_forward: fix memory leak during connection loss
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Norbert Menges <[email protected]>
  • Loading branch information
Garfield96 authored and edsiper committed Jan 22, 2024
1 parent 5dec222 commit 7218316
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions plugins/out_forward/forward.c
Original file line number Diff line number Diff line change
Expand Up @@ -1574,9 +1574,7 @@ static void cb_forward_flush(struct flb_event_chunk *event_chunk,
if (!u_conn) {
flb_plg_error(ctx->ins, "no upstream connections available");
msgpack_sbuffer_destroy(&mp_sbuf);
if (fc->time_as_integer == FLB_TRUE) {
flb_free(out_buf);
}
flb_free(out_buf);
flb_free(flush_ctx);
FLB_OUTPUT_RETURN(FLB_RETRY);
}
Expand All @@ -1590,9 +1588,7 @@ static void cb_forward_flush(struct flb_event_chunk *event_chunk,
flb_plg_error(ctx->ins, "no unix socket connection available");

msgpack_sbuffer_destroy(&mp_sbuf);
if (fc->time_as_integer == FLB_TRUE) {
flb_free(out_buf);
}
flb_free(out_buf);
flb_free(flush_ctx);
FLB_OUTPUT_RETURN(FLB_RETRY);
}
Expand Down Expand Up @@ -1622,9 +1618,7 @@ static void cb_forward_flush(struct flb_event_chunk *event_chunk,
}

msgpack_sbuffer_destroy(&mp_sbuf);
if (fc->time_as_integer == FLB_TRUE) {
flb_free(out_buf);
}
flb_free(out_buf);
flb_free(flush_ctx);
FLB_OUTPUT_RETURN(FLB_RETRY);
}
Expand Down

0 comments on commit 7218316

Please sign in to comment.