From: K.Kosako Date: Fri, 20 Sep 2019 08:11:40 +0000 (+0900) Subject: don't call onig_free() if onig_reg_init() is error X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9fd1d4495886d18ba6c131f5c4e700857f89c401;p=onig don't call onig_free() if onig_reg_init() is error --- diff --git a/src/regcomp.c b/src/regcomp.c index 2c00e0e..cd379a2 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -6785,11 +6785,14 @@ onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end, if (IS_NULL(*reg)) return ONIGERR_MEMORY; r = onig_reg_init(*reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax); - if (r != 0) goto err; + if (r != 0) { + xfree(*reg); + *reg = NULL; + return r; + } r = onig_compile(*reg, pattern, pattern_end, einfo); if (r != 0) { - err: onig_free(*reg); *reg = NULL; }