Skip to content

Commit 3336674

Browse files
committed
fix valgrind errors
1 parent e4572e6 commit 3336674

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

plugins/in_forward/fw_prot.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,11 @@ static int fw_process_message_mode_entry(
10641064

10651065
flb_log_event_encoder_reset(conn->ctx->log_encoder);
10661066

1067+
/* Check if connection was deleted during log append (e.g., due to pause) */
1068+
if (conn->being_deleted) {
1069+
return -1;
1070+
}
1071+
10671072
if (chunk_id != -1) {
10681073
chunk = options.via.map.ptr[chunk_id].val;
10691074
send_ack(in, conn, chunk);
@@ -1468,6 +1473,14 @@ int fw_prot_process(struct flb_input_instance *ins, struct fw_conn *conn)
14681473
out_tag, flb_sds_len(out_tag),
14691474
&entry.via.array.ptr[index],
14701475
chunk_id);
1476+
1477+
/* Check if connection was deleted during processing */
1478+
if (conn->being_deleted) {
1479+
msgpack_unpacked_destroy(&result);
1480+
msgpack_unpacker_free(unp);
1481+
flb_sds_destroy(out_tag);
1482+
return 0;
1483+
}
14711484
}
14721485

14731486
if (chunk_id != -1) {
@@ -1641,6 +1654,16 @@ int fw_prot_process(struct flb_input_instance *ins, struct fw_conn *conn)
16411654

16421655
goto cleanup_decompress;
16431656
}
1657+
1658+
/* Check if connection was deleted during append */
1659+
if (conn->being_deleted) {
1660+
flb_free(decomp_buf);
1661+
msgpack_unpacked_destroy(&result);
1662+
msgpack_unpacker_free(unp);
1663+
flb_sds_destroy(out_tag);
1664+
flb_decompression_context_destroy(conn->d_ctx);
1665+
return 0;
1666+
}
16441667
}
16451668
} while (decomp_len > 0);
16461669

0 commit comments

Comments
 (0)