Skip to content

Commit

Permalink
record_accessor: release tmp_str if allocation fails
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Jun 7, 2024
1 parent 285f3dd commit 7a27bcf
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/flb_record_accessor.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,18 +321,11 @@ struct flb_record_accessor *flb_ra_create(char *str, int translate_env)
if (buf) {
flb_sds_destroy(buf);
}
return NULL;
}
ra->pattern = tmp_str;
if (!ra->pattern) {
flb_error("[record accessor] could not allocate pattern");
flb_free(ra);
if (buf) {
flb_sds_destroy(buf);
}
flb_sds_destroy(tmp_str);
return NULL;
}

ra->pattern = tmp_str;
mk_list_init(&ra->list);

/*
Expand Down

0 comments on commit 7a27bcf

Please sign in to comment.