From fff544a1e97e13b82415be0d915bd9a5dc2ec19d Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Tue, 6 Oct 2020 08:04:40 +0000 Subject: [PATCH] Fix potential memory leak in error situation in recent new code. --- src/pcre2grep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pcre2grep.c b/src/pcre2grep.c index 65c248f..851bb89 100644 --- a/src/pcre2grep.c +++ b/src/pcre2grep.c @@ -2390,8 +2390,10 @@ while (length > 0) } 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; }