[sr-dev] git:5.1:ee4f8d48: nathelper: Fixed memory leak in nathelper fetch contact timer (GH #2062)

Henning Westerholt hw at skalatan.de
Tue Sep 10 09:18:08 CEST 2019


Module: kamailio
Branch: 5.1
Commit: ee4f8d48806c5f9ad324de1c121b73222a4ef783
URL: https://github.com/kamailio/kamailio/commit/ee4f8d48806c5f9ad324de1c121b73222a4ef783

Author: Pintu Lohar <plohar at sk.com>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-09-10T09:17:46+02:00

nathelper: Fixed memory leak in nathelper fetch contact timer (GH #2062)

- Allocated buffer is not freed when contact fetch is failed
- Leak frequently occur when database disconnect and reconnect

(cherry picked from commit 79fecc643d0a17b4de25f54ae269d1bee1f0cb00)

---

Modified: src/modules/nathelper/nathelper.c

---

Diff:  https://github.com/kamailio/kamailio/commit/ee4f8d48806c5f9ad324de1c121b73222a4ef783.diff
Patch: https://github.com/kamailio/kamailio/commit/ee4f8d48806c5f9ad324de1c121b73222a4ef783.patch

---

diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c
old mode 100644
new mode 100755
index c616aa42eb..47584d2ac8
--- a/src/modules/nathelper/nathelper.c
+++ b/src/modules/nathelper/nathelper.c
@@ -1953,6 +1953,8 @@ static void nh_timer(unsigned int ticks, void *timer_idx)
 					+ iteration,
 			natping_processes * natping_interval, options);
 	if(rval < 0) {
+		if(buf != NULL)
+			pkg_free(buf);
 		LM_ERR("failed to fetch contacts\n");
 		goto done;
 	}




More information about the sr-dev mailing list