[sr-dev] git:master:375d0146: presence: check for null head when reordering returned presentity list

Daniel-Constantin Mierla miconda at gmail.com
Fri May 8 21:52:46 CEST 2020


Module: kamailio
Branch: master
Commit: 375d01466dffcef9e7064f4100a5afef48dbde39
URL: https://github.com/kamailio/kamailio/commit/375d01466dffcef9e7064f4100a5afef48dbde39

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-05-08T21:37:52+02:00

presence: check for null head when reordering returned presentity list

---

Modified: src/modules/presence/hash.c

---

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

---

diff --git a/src/modules/presence/hash.c b/src/modules/presence/hash.c
index 9c81b7bd8e..c313b01cf0 100644
--- a/src/modules/presence/hash.c
+++ b/src/modules/presence/hash.c
@@ -1296,7 +1296,9 @@ ps_presentity_t *ps_ptable_search(ps_presentity_t *ptm, int mmode, int rmode)
 					ptl->prev = NULL;
 				}
 				ptd->next = pte;
-				pte->prev = ptd;
+				if(pte) {
+					pte->prev = ptd;
+				}
 				pte = ptd;
 			} else {
 				if(ptd->prev) {
@@ -1307,7 +1309,9 @@ ps_presentity_t *ps_ptable_search(ps_presentity_t *ptm, int mmode, int rmode)
 				}
 				ptd->next = pte;
 				ptd->prev = NULL;
-				pte->prev = ptd;
+				if(pte) {
+					pte->prev = ptd;
+				}
 				pte = ptd;
 			}
 		}
@@ -1394,4 +1398,4 @@ ps_presentity_t *ps_ptable_get_expired(int eval)
 	}
 
 	return ptl;
-}
\ No newline at end of file
+}




More information about the sr-dev mailing list