From 565e3643dd3f12fc275d2fb0f7642b17afd00691 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 23 Jun 2014 14:33:55 +0000 Subject: [PATCH] * regex/regcomp.c (computematchjumps): Free local memory in case of error (CID 59975). --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/regex/regcomp.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d12f6f855..77a612418 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2014-06-23 Corinna Vinschen + + * regex/regcomp.c (computematchjumps): Free local memory in case of + error (CID 59975). + 2014-06-23 Corinna Vinschen * mount.cc (fs_info::update): Define dir in the outermost scope to avoid diff --git a/winsup/cygwin/regex/regcomp.c b/winsup/cygwin/regex/regcomp.c index b68db99c7..d68dcc32a 100644 --- a/winsup/cygwin/regex/regcomp.c +++ b/winsup/cygwin/regex/regcomp.c @@ -1803,7 +1803,10 @@ computematchjumps(struct parse *p, struct re_guts *g) g->matchjump = (int*) malloc(g->mlen * sizeof(unsigned int)); if (g->matchjump == NULL) /* Not a fatal error */ + { + free (pmatches); return; + } /* Set maximum possible jump for each character in the pattern */ for (mindex = 0; mindex < g->mlen; mindex++) -- 2.43.5