Skip to content

Commit

Permalink
grep: release rule if flb_sds_create_size failed
Browse files Browse the repository at this point in the history
Signed-off-by: Takahiro Yamashita <[email protected]>
  • Loading branch information
nokute78 committed Feb 2, 2024
1 parent 3c81f58 commit 011a86e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/flb_grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ int flb_grep_set_rule_str(struct flb_grep *grep_ctx, enum flb_grep_rule_type typ
}
else {
rule->field = flb_sds_create_size(sentry->len + 2);
if (rule->field == NULL) {
flb_error("flb_sds_create_size failed");
delete_rule(rule);
flb_utils_split_free(split);
return -1;
}
ret = flb_sds_cat_safe(&rule->field, "$", 1);
if (ret != 0) {
flb_error("flb_sds_cat_safe failed");
Expand Down

0 comments on commit 011a86e

Please sign in to comment.