Skip to content

Commit 22346a7

Browse files
parser: json: fix double-free (#3453)
Signed-off-by: davkor <[email protected]>
1 parent 592d401 commit 22346a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/flb_parser_json.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ int flb_parser_json_do(struct flb_parser *parser,
111111
*out_size = tmp_out_size;
112112
if (mp_buf != tmp_out_buf) {
113113
flb_free(mp_buf);
114+
mp_buf = NULL;
114115
}
115116

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

0 commit comments

Comments
 (0)