summaryrefslogtreecommitdiffhomepage
path: root/tools/mrbc
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-06-03 09:41:32 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-06-03 09:41:32 -0700
commitd8f1e17ef6282b15c945f1feb5b75c36be96f20e (patch)
treee036ad5bf1629f748af8f3084ca8a15cccd07e19 /tools/mrbc
parent0719f523048ecd6da1d28e4b2eba7794e419dd36 (diff)
parent2fff59dc8674ad6689acc5080463eede4c5bb2ab (diff)
downloadmruby-d8f1e17ef6282b15c945f1feb5b75c36be96f20e.tar.gz
mruby-d8f1e17ef6282b15c945f1feb5b75c36be96f20e.zip
Merge pull request #239 from thecodeshop/jf/mrb_open
guard mrb_open mem allocation and downstream usage
Diffstat (limited to 'tools/mrbc')
-rw-r--r--tools/mrbc/mrbc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/mrbc/mrbc.c b/tools/mrbc/mrbc.c
index 3553fe646..99fea76d8 100644
--- a/tools/mrbc/mrbc.c
+++ b/tools/mrbc/mrbc.c
@@ -158,6 +158,11 @@ main(int argc, char **argv)
struct _args args;
struct mrb_parser_state *p;
+ if (mrb == NULL) {
+ fprintf(stderr, "Invalid mrb_state, exiting mrbc");
+ return EXIT_FAILURE;
+ }
+
n = parse_args(mrb, argc, argv, &args);
if (n < 0 || args.rfp == NULL) {