Author: delphij
Date: Fri Jan  2 18:51:47 2015
New Revision: 276554
URL: https://svnweb.freebsd.org/changeset/base/276554

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

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

Modified: stable/9/lib/libc/regex/regcomp.c
==============================================================================
--- stable/9/lib/libc/regex/regcomp.c   Fri Jan  2 18:50:18 2015        
(r276553)
+++ stable/9/lib/libc/regex/regcomp.c   Fri Jan  2 18:51:47 2015        
(r276554)
@@ -1699,8 +1699,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-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to