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++)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to