From 5cfb7bc8feecc82eb161450faa572abf9be19cbb Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@fabiankeil.de>
Date: Thu, 24 Sep 2020 10:44:00 +0200
Subject: [PATCH] pcrs_filter_response(): Free the old data if there are no
 hits

... and it's different from the data in iob and the new data.

Fixes a memory leak if multiple filters are executed
and the last one is skipped due to a pcre error.
---
 filters.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/filters.c b/filters.c
index 13cba16a..7b586bc0 100644
--- a/filters.c
+++ b/filters.c
@@ -1671,6 +1671,10 @@ static char *pcrs_filter_response(struct client_state *csp)
     */
    if (!hits)
    {
+      if (old != csp->iob->cur && old != new)
+      {
+         freez(old);
+      }
       freez(new);
       return(NULL);
    }
-- 
2.49.0