out_websocket: fix leak on exception (CID 316420)
@@ -256,9 +256,13 @@ static void cb_ws_flush(const void *data, size_t bytes,
else {
ret = flb_ws_sendDataFrameHeader(u_conn, ctx, json, flb_sds_len(json));
}
+
if (ret == -1) {
flb_error("[out_ws] dataFrameHeader sent failed");
ctx->handshake = 1;
+ if (json) {
+ flb_sds_destroy(json);
+ }
flb_upstream_conn_release(u_conn);
FLB_OUTPUT_RETURN(FLB_RETRY);
}
