[sr-dev] git:master:3f92119f: Merge pull request #717 from athonet-open/fix_shutdown_presence

GitHub noreply at github.com
Tue Jul 19 22:01:08 CEST 2016


Module: kamailio
Branch: master
Commit: 3f92119fe168baf516738be4be8142bd2c467760
URL: https://github.com/kamailio/kamailio/commit/3f92119fe168baf516738be4be8142bd2c467760

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: GitHub <noreply at github.com>
Date: 2016-07-19T22:01:01+02:00

Merge pull request #717 from athonet-open/fix_shutdown_presence

presence: fix potential double free in shutdown routine

---

Modified: modules/presence/hash.c

---

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

---

diff --git a/modules/presence/hash.c b/modules/presence/hash.c
index 5c30291..50657e0 100644
--- a/modules/presence/hash.c
+++ b/modules/presence/hash.c
@@ -318,9 +318,14 @@ int delete_shtable(shtable_t htable,unsigned int hash_code,subs_t* subs)
 		{
 			found= s->local_cseq +1;
 			ps->next= s->next;
-			if(s->contact.s!=NULL)
+			if(s->contact.s!=NULL) {
 				shm_free(s->contact.s);
-			shm_free(s);
+				s->contact.s = NULL;
+			}
+			if (s) {
+				shm_free(s);
+				s = NULL;
+			}
 			break;
 		}
 		ps= s;




More information about the sr-dev mailing list