Skip to content

Commit dc6fe98

Browse files
committed
out_stackdriver: fix leak in json packer
Signed-off-by: Eduardo Silva <[email protected]>
1 parent a2cecee commit dc6fe98

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugins/out_stackdriver/stackdriver.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ static int get_stream(msgpack_object_map map)
730730
}
731731

732732
static int pack_json_payload(int operation_extracted, int operation_extra_size,
733-
msgpack_packer* mp_pck, msgpack_object *obj)
733+
msgpack_packer *mp_pck, msgpack_object *obj)
734734
{
735735
/* Specified fields include local_resource_id, operation, sourceLocation ... */
736736
int i, j;
@@ -783,11 +783,13 @@ static int pack_json_payload(int operation_extracted, int operation_extra_size,
783783
/* optimize, pack the original obj */
784784
if (new_map_size == map_size) {
785785
msgpack_pack_object(mp_pck, *obj);
786+
flb_sds_destroy(local_resource_id_key);
786787
return 0;
787788
}
788789

789790
ret = msgpack_pack_map(mp_pck, new_map_size);
790791
if (ret < 0) {
792+
flb_sds_destroy(local_resource_id_key);
791793
return ret;
792794
}
793795

@@ -818,10 +820,12 @@ static int pack_json_payload(int operation_extracted, int operation_extra_size,
818820
if (key_not_found) {
819821
ret = msgpack_pack_object(mp_pck, kv->key);
820822
if (ret < 0) {
823+
flb_sds_destroy(local_resource_id_key);
821824
return ret;
822825
}
823826
ret = msgpack_pack_object(mp_pck, kv->val);
824827
if (ret < 0) {
828+
flb_sds_destroy(local_resource_id_key);
825829
return ret;
826830
}
827831
}

0 commit comments

Comments
 (0)