svn commit: r275930 - head/lib/libc/regex

Xin LI delphij at FreeBSD.org
Fri Dec 19 06:48:48 UTC 2014


Author: delphij
Date: Fri Dec 19 06:48:47 2014
New Revision: 275930
URL: https://svnweb.freebsd.org/changeset/base/275930

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

Modified:
  head/lib/libc/regex/regcomp.c

Modified: head/lib/libc/regex/regcomp.c
==============================================================================
--- head/lib/libc/regex/regcomp.c	Fri Dec 19 01:41:51 2014	(r275929)
+++ head/lib/libc/regex/regcomp.c	Fri Dec 19 06:48:47 2014	(r275930)
@@ -1716,8 +1716,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++)


More information about the svn-src-all mailing list