Skip to content

Commit

Permalink
parser: json: fix double-free (#3453)
Browse files Browse the repository at this point in the history
Signed-off-by: davkor <david@adalogics.com>
  • Loading branch information
DavidKorczynski committed May 6, 2021
1 parent 592d401 commit 22346a7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/flb_parser_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ int flb_parser_json_do(struct flb_parser *parser,
*out_size = tmp_out_size;
if (mp_buf != tmp_out_buf) {
flb_free(mp_buf);
mp_buf = NULL;
}

/* Do time resolution ? */
Expand Down Expand Up @@ -141,6 +142,7 @@ int flb_parser_json_do(struct flb_parser *parser,
/* Ensure the pointer we are about to read is not NULL */
if (k->via.str.ptr == NULL) {
flb_free(mp_buf);
flb_free(tmp_out_buf);
*out_buf = NULL;
msgpack_unpacked_destroy(&result);
return -1;
Expand Down

0 comments on commit 22346a7

Please sign in to comment.