summaryrefslogtreecommitdiff
path: root/regparse.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-08 17:52:38 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-08 17:52:38 (GMT)
commitb3935f179b3a5668320eab59a07e4de7b747546d (patch)
tree24d96826c2e0f47497f8f45df33121c17b5bc6b7 /regparse.c
parent6db71fb11af4e3f1a79678f6dec6b2c10d012eff (diff)
* gc.c (rb_gc_unprotect_logging): throw rb_memerror when it cannot
allocate memory. This is pointed out by Facebook's Infer. * gc.c (gc_prof_setup_new_record): ditto. * regparse.c (parse_regexp): ditto. * util.c (MALLOC): use xmalloc and xfree like above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regparse.c')
-rw-r--r--regparse.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/regparse.c b/regparse.c
index d3907de..f405f54 100644
--- a/regparse.c
+++ b/regparse.c
@@ -6460,7 +6460,10 @@ parse_regexp(Node** top, UChar** src, UChar* end, ScanEnv* env)
NENCLOSE(np)->regnum = num;
NENCLOSE(np)->target = *top;
r = scan_env_set_mem_node(env, num, np);
- if (r != 0) return r;
+ if (r != 0) {
+ onig_node_free(np);
+ return r;
+ }
*top = np;
}
#endif