summaryrefslogtreecommitdiff
path: root/regparse.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-01 21:54:59 (GMT)
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-01 21:54:59 (GMT)
commitdb37773e13fba8ccb28612361220638e702d4deb (patch)
tree72ffe3fbbb7762810ec3780c3004408ee5d0d693 /regparse.c
parente1c33162cf821b5251559564242e0d91ad29a79c (diff)
* include/ruby/oniguruma.h: updated to follow Oniguruma 5.9.2.
* re.c (make_regexp): use onig_new() instead of onig_alloc_init(). * re.c (rb_reg_to_s): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regparse.c')
-rw-r--r--regparse.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/regparse.c b/regparse.c
index 67da551..eb40cf6 100644
--- a/regparse.c
+++ b/regparse.c
@@ -3,7 +3,7 @@
regparse.c - Oniguruma (regular expression library)
**********************************************************************/
/*-
- * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
+ * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -794,6 +794,7 @@ name_add(regex_t* reg, UChar* name, UChar* name_end, int backref, ScanEnv* env)
e = &(t->e[t->num]);
t->num++;
e->name = strdup_with_null(reg->enc, name, name_end);
+ if (IS_NULL(e->name)) return ONIGERR_MEMORY;
e->name_len = name_end - name;
#endif
}
@@ -5499,7 +5500,10 @@ parse_exp(Node** np, OnigToken* tok, int term,
CHECK_NULL_RETURN_MEMERR(qn);
NQTFR(qn)->greedy = tok->u.repeat.greedy;
r = set_quantifier(qn, *targetp, group, env);
- if (r < 0) return r;
+ if (r < 0) {
+ onig_node_free(qn);
+ return r;
+ }
if (tok->u.repeat.possessive != 0) {
Node* en;
@@ -5522,9 +5526,15 @@ parse_exp(Node** np, OnigToken* tok, int term,
Node *tmp;
*targetp = node_new_list(*targetp, NULL);
- CHECK_NULL_RETURN_MEMERR(*targetp);
+ if (IS_NULL(*targetp)) {
+ onig_node_free(qn);
+ return ONIGERR_MEMORY;
+ }
tmp = NCDR(*targetp) = node_new_list(qn, NULL);
- CHECK_NULL_RETURN_MEMERR(tmp);
+ if (IS_NULL(tmp)) {
+ onig_node_free(qn);
+ return ONIGERR_MEMORY;
+ }
targetp = &(NCAR(tmp));
}
goto re_entry;