Skip to content

Commit

Permalink
Free key and search, replace patterns (netdata#16789)
Browse files Browse the repository at this point in the history
Free key and search pattern
  • Loading branch information
stelfrag committed Jan 15, 2024
1 parent 997e771 commit a3d5e6c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions collectors/log2journal/log2journal-yaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ static size_t yaml_parse_rewrites(yaml_parser_t *parser, LOG_JOB *jb) {
yaml_error(parser, &sub_event, "Expected scalar for rewrite key");
errors++;
} else {
freez(key);
key = strndupz((char *)sub_event.data.scalar.value, sub_event.data.scalar.length);
yaml_event_delete(&sub_event);
}
Expand Down Expand Up @@ -498,6 +499,7 @@ static size_t yaml_parse_rewrites(yaml_parser_t *parser, LOG_JOB *jb) {
yaml_error(parser, &sub_event, "Expected scalar for rewrite value");
errors++;
} else {
freez(replace_pattern);
replace_pattern = strndupz((char *)sub_event.data.scalar.value, sub_event.data.scalar.length);
yaml_event_delete(&sub_event);
}
Expand Down Expand Up @@ -563,6 +565,8 @@ static size_t yaml_parse_rewrites(yaml_parser_t *parser, LOG_JOB *jb) {
}
freez(replace_pattern);
replace_pattern = NULL;
freez(search_pattern);
search_pattern = NULL;
}
break;

Expand Down

0 comments on commit a3d5e6c

Please sign in to comment.