Skip to content

Commit

Permalink
Fix memory leak when parsing invalid YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
cristgl committed Jul 25, 2019
1 parent 2b6f8f6 commit e800a13
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/shared/yaml2json.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ int yaml_parse_file(const char * path, yaml_document_t * document) {
error = 0;
} else {
mwarn("Failed to load YAML document in %s:%u", path, (unsigned int)parser.problem_mark.line);
yaml_document_delete(document);
}

yaml_parser_delete(&parser);
Expand Down
1 change: 1 addition & 0 deletions src/wazuh_modules/wm_sca.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ static void wm_sca_read_files(wm_sca_t * data) {

if (object = yaml2json(&document,1), !object) {
mwarn("Transforming yaml to json: '%s'. Skipping it.",path);
yaml_document_delete(&document);
goto next;
}

Expand Down

0 comments on commit e800a13

Please sign in to comment.