ext/yarp/extension.c in yarp-0.11.0 vs ext/yarp/extension.c in yarp-0.12.0
- old
+ new
@@ -411,11 +411,15 @@
VALUE filepath;
rb_scan_args(argc, argv, "11", &string, &filepath);
yp_string_t input;
input_load_string(&input, string);
- return parse_lex_input(&input, check_string(filepath), true);
+
+ VALUE value = parse_lex_input(&input, check_string(filepath), true);
+ yp_string_free(&input);
+
+ return value;
}
// Parse and lex the given file and return a ParseResult instance.
static VALUE
parse_lex_file(VALUE self, VALUE filepath) {
@@ -528,10 +532,12 @@
yp_node_t *node = yp_parse(&parser);
yp_node_destroy(&parser, node);
yp_parser_free(&parser);
+ yp_string_free(&input);
+
return Qnil;
}
// Parse the file and serialize the result. This is mostly used to test this
// path since it is used by client libraries.
@@ -545,9 +551,10 @@
if (!yp_string_mapped_init(&input, checked)) return Qnil;
yp_parse_serialize(yp_string_source(&input), yp_string_length(&input), &buffer, check_string(metadata));
VALUE result = rb_str_new(yp_buffer_value(&buffer), yp_buffer_length(&buffer));
+ yp_string_free(&input);
yp_buffer_free(&buffer);
return result;
}
/******************************************************************************/