Ticket #145: yaml-leak.c

File yaml-leak.c, 528 bytes (added by pem@…, 4 years ago)
Line 
1#include <stdlib.h>
2#include <stdio.h>
3#include <yaml.h>
4
5int
6main(int argc, char **argv)
7{
8    yaml_document_t doc;
9    yaml_parser_t parser;
10
11    yaml_document_initialize(&doc, NULL, NULL, NULL, 0, 0);
12    yaml_parser_initialize(&parser);
13    yaml_parser_set_encoding(&parser, YAML_UTF8_ENCODING);
14    yaml_parser_set_input_file(&parser, stdin);
15    if (! yaml_parser_load(&parser, &doc))
16        fprintf(stderr, "yaml_parser_load() failed\n");
17    yaml_parser_delete(&parser);
18    yaml_document_delete(&doc);
19
20    exit(0);
21}