PATCH: regex: regfree on pattern where regcomp failed could be undefined behavior

Mikael Magnusson <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
---
 Src/Modules/regex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Src/Modules/regex.c b/Src/Modules/regex.c
index d02769ef03..859312a2a4 100644
--- a/Src/Modules/regex.c
+++ b/Src/Modules/regex.c
@@ -77,7 +77,7 @@ zcond_regex_match(char **a, int id)
 	r = regcomp(&re, rhre, rcflags);
 	if (r) {
 	    zregex_regerrwarn(r, &re, "failed to compile regex");
-	    break;
+	    goto CLEAN_BASEMETA;
 	}
 	/* re.re_nsub is number of parenthesized groups, we also need
 	 * 1 for the 0 offset, which is the entire matched portion
-- 
2.38.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.