From d1cd10421f8bfeee791ea7ecd1674eccd00000ae Mon Sep 17 00:00:00 2001 From: Mitchell Blank Jr Date: Tue, 22 May 2012 01:03:54 -0700 Subject: change example code to do mrb_close() I was hoping this would cause valgrind to complain less, but there is still a lot of memory leaked (does mrb_close() actually free all of the managed blocks?) Anyway this helps somewhat and is good practice --- tools/mrbc/mrbc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/mrbc') diff --git a/tools/mrbc/mrbc.c b/tools/mrbc/mrbc.c index dd210bfa9..e711b69cb 100644 --- a/tools/mrbc/mrbc.c +++ b/tools/mrbc/mrbc.c @@ -163,12 +163,14 @@ main(int argc, char **argv) if (n < 0 || args.rfp == NULL) { cleanup(&args); usage(argv[0]); + mrb_close(mrb); return n; } p = mrb_parse_file(mrb, args.rfp); if (!p || !p->tree || p->nerr) { cleanup(&args); + mrb_close(mrb); return -1; } @@ -183,6 +185,7 @@ main(int argc, char **argv) if (n < 0 || args.check_syntax) { cleanup(&args); + mrb_close(mrb); return n; } if (args.initname) { @@ -196,6 +199,7 @@ main(int argc, char **argv) } cleanup(&args); + mrb_close(mrb); return n; } -- cgit v1.2.3