Skip to content

Commit

Permalink
Merge pull request #3422 from DavidKorczynski/new-fix-4
Browse files Browse the repository at this point in the history
parser_decoder: fix memory leak.
  • Loading branch information
nokute78 authored May 2, 2021
2 parents 548ff01 + 03e02be commit c7dc097
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/flb_parser_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ int flb_parser_decoder_do(struct mk_list *decoders,
* The content of this buffer is just a serialized number of maps.
*/
if (dec->add_extra_keys == FLB_TRUE) {
/* We need to clean up already allocated extra buffers */
if (extra_keys == FLB_TRUE) {
msgpack_sbuffer_destroy(&extra_mp_sbuf);
}
extra_keys = FLB_TRUE;
msgpack_sbuffer_init(&extra_mp_sbuf);
msgpack_packer_init(&extra_mp_pck, &extra_mp_sbuf,
Expand Down

0 comments on commit c7dc097

Please sign in to comment.