diff --git a/src/parser.c b/src/parser.c index 6e3918ed..1198c737 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1316,7 +1316,8 @@ yaml_parser_process_directives(yaml_parser_t *parser, STACK_DEL(parser, tag_directives); } - yaml_free(version_directive); + if (!version_directive_ref) + yaml_free(version_directive); return 1; error: