[sr-dev] git:master:9f16a7fa: Merge pull request #754 from athonet-open/fix__presence_dbl_free

GitHub noreply at github.com
Mon Aug 22 09:40:27 CEST 2016


Module: kamailio
Branch: master
Commit: 9f16a7fa09ad14295e1b1046de110b546c498b01
URL: https://github.com/kamailio/kamailio/commit/9f16a7fa09ad14295e1b1046de110b546c498b01

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: GitHub <noreply at github.com>
Date: 2016-08-22T09:40:23+02:00

Merge pull request #754 from athonet-open/fix__presence_dbl_free

presence: fix multiple double free on shutdown caught with memlog=1

---

Modified: modules/presence/hash.c

---

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

---

diff --git a/modules/presence/hash.c b/modules/presence/hash.c
index 50657e0..bfce59d 100644
--- a/modules/presence/hash.c
+++ b/modules/presence/hash.c
@@ -101,6 +101,7 @@ void destroy_shtable(shtable_t htable, int hash_size)
 		lock_destroy(&htable[i].lock);
 		free_subs_list(htable[i].entries->next, SHM_MEM_TYPE, 1);
 		shm_free(htable[i].entries);
+		htable[i].entries = NULL;
 	}
 	shm_free(htable);
 	htable= NULL;
@@ -345,15 +346,21 @@ void free_subs_list(subs_t* s_array, int mem_type, int ic)
 		s_array= s_array->next;
 		if(mem_type & PKG_MEM_TYPE)
 		{
-			if(ic)
+			if(ic) {
 				pkg_free(s->contact.s);
+				s->contact.s = NULL;
+			}
 			pkg_free(s);
+			s = NULL;
 		}
 		else
 		{
-			if(ic)
+			if(ic) {
 				shm_free(s->contact.s);
+				s->contact.s = NULL;
+			}
 			shm_free(s);
+			s = NULL;
 		}
 	}
 	




More information about the sr-dev mailing list