svn commit: r276548 - stable/10/lib/libc/regex

Xin LI delphij at FreeBSD.org
Fri Jan 2 18:31:14 UTC 2015


Author: delphij
Date: Fri Jan  2 18:31:12 2015
New Revision: 276548
URL: https://svnweb.freebsd.org/changeset/base/276548

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

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

Modified: stable/10/lib/libc/regex/regcomp.c
==============================================================================
--- stable/10/lib/libc/regex/regcomp.c	Fri Jan  2 18:27:32 2015	(r276547)
+++ stable/10/lib/libc/regex/regcomp.c	Fri Jan  2 18:31:12 2015	(r276548)
@@ -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-stable-10 mailing list