Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/in_elasticsearch/in_elasticsearch_bulk_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ static int get_write_op(struct flb_in_elasticsearch *ctx, msgpack_object *map, f
msgpack_object key;
int check = FLB_FALSE;

if (map->via.map.size == 0) {
return FLB_FALSE;
Comment on lines +286 to +287
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Clear stale write_op on empty metadata maps

In a bulk payload where a delete metadata line is followed by an empty map, the delete branch frees write_op but leaves the caller's variable non-NULL before goto proceed; this new early return leaves out_write_op untouched, so the caller's else path calls flb_sds_destroy(write_op) again on the stale pointer. Please clear *out_write_op (and the size) before returning false, or otherwise ensure the caller does not reuse a previously freed value.

Useful? React with 👍 / 👎.

}

kv = map->via.map.ptr;
key = kv[0].key;
if (key.type == MSGPACK_OBJECT_BIN) {
Expand Down
Loading