[Privoxy-commits] [privoxy] 03/26: pcrs_execute(): Plug unlikely memory leaks

User Git git at git.privoxy.org
Sat Oct 10 09:01:29 CEST 2026


This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository privoxy.

commit 68369e3b90f00969434436e836de12469c8a5c85
Author: Fabian Keil <fk at fabiankeil.de>
AuthorDate: Sun Sep 6 12:13:58 2026 +0200

    pcrs_execute(): Plug unlikely memory leaks
---
 pcrs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pcrs.c b/pcrs.c
index 5ff35f2a..509bdc2e 100644
--- a/pcrs.c
+++ b/pcrs.c
@@ -823,6 +823,8 @@ int pcrs_execute(pcrs_job *job, const char *subject, size_t subject_length, char
 
    if (NULL == (matches = (pcrs_match *)malloc((size_t)max_matches * sizeof(pcrs_match))))
    {
+      pcre2_match_data_free(pcre2_matches);
+
       return(PCRS_ERR_NOMEM);
    }
    memset(matches, '\0', (size_t)max_matches * sizeof(pcrs_match));
@@ -876,6 +878,8 @@ int pcrs_execute(pcrs_job *job, const char *subject, size_t subject_length, char
          if (NULL == (dummy = (pcrs_match *)realloc(matches, (size_t)max_matches * sizeof(pcrs_match))))
          {
             free(matches);
+            pcre2_match_data_free(pcre2_matches);
+
             return(PCRS_ERR_NOMEM);
          }
          matches = dummy;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Privoxy-commits mailing list