Browse code

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

Pintu Lohar authored on 10/09/2019 07:14:00
Showing 1 changed files
1 1
old mode 100644
2 2
new mode 100755
... ...
@@ -2003,6 +2003,8 @@ static void nh_timer(unsigned int ticks, void *timer_idx)
2003 2003
 					+ iteration,
2004 2004
 			natping_processes * natping_interval, options);
2005 2005
 	if(rval < 0) {
2006
+		if(buf != NULL)
2007
+			pkg_free(buf);
2006 2008
 		LM_ERR("failed to fetch contacts\n");
2007 2009
 		goto done;
2008 2010
 	}