[sr-dev] git:master:53b13956: presence: fix crash when no dialog.id on dialog-info xml

Victor Seva linuxmaniac at torreviejawireless.org
Fri Sep 23 13:34:52 CEST 2016


Module: kamailio
Branch: master
Commit: 53b139567cd2c828cf2cf387029396ef55351289
URL: https://github.com/kamailio/kamailio/commit/53b139567cd2c828cf2cf387029396ef55351289

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2016-09-23T11:11:56+02:00

presence: fix crash when no dialog.id on dialog-info xml

Fix #794

---

Modified: modules/presence/presentity.c

---

Diff:  https://github.com/kamailio/kamailio/commit/53b139567cd2c828cf2cf387029396ef55351289.diff
Patch: https://github.com/kamailio/kamailio/commit/53b139567cd2c828cf2cf387029396ef55351289.patch

---

diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
index e601153..00fdbfd 100644
--- a/modules/presence/presentity.c
+++ b/modules/presence/presentity.c
@@ -691,13 +691,13 @@ int update_presentity(struct sip_msg* msg, presentity_t* presentity, str* body,
 			}
 
 			check_if_dialog(*body, &is_dialog, &dialog_id);
+			if (is_dialog == 1) {
+				if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) {
+					goto error;
+				}
 
-			if (delete_presentity_if_dialog_id_exists(presentity, dialog_id) < 0) {
-				goto error;
+				free(dialog_id);
 			}
-
-			free(dialog_id);
-
 			LM_DBG("inserting %d cols into table\n",n_query_cols);
 
 			if (pa_dbf.insert(pa_db, query_cols, query_vals, n_query_cols) < 0)




More information about the sr-dev mailing list