summaryrefslogtreecommitdiffstats
path: root/net/freeswitch/patches/502-mod_verto-Fix-memory-leak-by-correctly-freeing-regex.patch
blob: 706c6ce5fac4033dc6d08a2f2147a73146ad4047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From 2a4c882464b792ac827c98b5d09e5a89b471a75a Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 3 Nov 2023 17:27:06 +0100
Subject: [PATCH 1/3] [mod_verto] Fix memory leak by correctly freeing regex

For mod_verto regex was never freed and was actually leaking memory.
Correctly free the compiled regex to fix the memory leak.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 src/mod/endpoints/mod_verto/mod_verto.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/src/mod/endpoints/mod_verto/mod_verto.c
+++ b/src/mod/endpoints/mod_verto/mod_verto.c
@@ -1893,10 +1893,12 @@ authed:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 								  "%d request [%s] matched expr [%s]\n", proceed, request->uri, expression);
 				request->uri = rule->value;
+				switch_regex_safe_free(re);
 				break;
 			}
 
 			rule = rule->next;
+			switch_regex_safe_free(re);
 		}
 	}