nathelper: Fixed memory leak in nathelper fetch contact timer (GH #2062)
authorPintu Lohar <plohar@sk.com>
Tue, 10 Sep 2019 07:14:00 +0000 (09:14 +0200)
committerHenning Westerholt <hw@skalatan.de>
Tue, 10 Sep 2019 07:15:26 +0000 (09:15 +0200)
- Allocated buffer is not freed when contact fetch is failed
- Leak frequently occur when database disconnect and reconnect

src/modules/nathelper/nathelper.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 4426b93..e77c947
@@ -2003,6 +2003,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;
        }