Skip to content

Commit

Permalink
parser_decoder: fix memory leak.
Browse files Browse the repository at this point in the history
Signed-off-by: davkor <[email protected]>
  • Loading branch information
DavidKorczynski committed Apr 26, 2021
1 parent 9c992e4 commit 03e02be
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 03e02be

Please sign in to comment.