[Pcre-svn] [1276] code/trunk/src/pcre2grep.c: Fix potential …

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1276] code/trunk/src/pcre2grep.c: Fix potential memory leak in error situation in recent new code.
Revision: 1276
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1276
Author:   ph10
Date:     2020-10-06 09:04:40 +0100 (Tue, 06 Oct 2020)
Log Message:
-----------
Fix potential memory leak in error situation in recent new code.


Modified Paths:
--------------
    code/trunk/src/pcre2grep.c


Modified: code/trunk/src/pcre2grep.c
===================================================================
--- code/trunk/src/pcre2grep.c    2020-10-05 16:52:39 UTC (rev 1275)
+++ code/trunk/src/pcre2grep.c    2020-10-06 08:04:40 UTC (rev 1276)
@@ -2390,8 +2390,10 @@
         }
       break;


-      default:         /* Should not occur */
-      case DDE_ERROR:
+      default:         /* Even though this should not occur, the string having */
+      case DDE_ERROR:  /* been checked above, we need to include the free() */
+      free(args);      /* calls so that source checkers do not complain. */
+      free(argsvector);
       return 0;
       }