summaryrefslogtreecommitdiff
path: root/regparse.c
diff options
context:
space:
mode:
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 0caecc11ed..3d2c57a25a 100644
--- a/regparse.c
+++ b/regparse.c
@@ -729,7 +729,10 @@ name_add(regex_t* reg, UChar* name, UChar* name_end, int backref, ScanEnv* env)
CHECK_NULL_RETURN_MEMERR(e);
e->name = strdup_with_null(reg->enc, name, name_end);
- if (IS_NULL(e->name)) return ONIGERR_MEMORY;
+ if (IS_NULL(e->name)) {
+ xfree(e);
+ return ONIGERR_MEMORY;
+ }
onig_st_insert_strend(t, e->name, (e->name + (name_end - name)),
(HashDataType )e);