Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Jan 2015 18:52:19 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r276555 - stable/8/lib/libc/regex
Message-ID:  <201501021852.t02IqJDY075118@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Fri Jan  2 18:52:18 2015
New Revision: 276555
URL: https://svnweb.freebsd.org/changeset/base/276555

Log:
  MFC r275930:
  
  Plug a memory leak.
  
  Obtained from:	DragonFlyBSD (commit 5119ece)

Modified:
  stable/8/lib/libc/regex/regcomp.c
Directory Properties:
  stable/8/lib/libc/   (props changed)

Modified: stable/8/lib/libc/regex/regcomp.c
==============================================================================
--- stable/8/lib/libc/regex/regcomp.c	Fri Jan  2 18:51:47 2015	(r276554)
+++ stable/8/lib/libc/regex/regcomp.c	Fri Jan  2 18:52:18 2015	(r276555)
@@ -1693,8 +1693,10 @@ computematchjumps(struct parse *p, struc
 	}
 
 	g->matchjump = (int*) malloc(g->mlen * sizeof(unsigned int));
-	if (g->matchjump == NULL)	/* Not a fatal error */
+	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++)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501021852.t02IqJDY075118>