[sr-dev] git:master:16c8d5e4: ims_dialog: fix small refcount bug

jaybeepee jason.penton at gmail.com
Mon Feb 29 13:17:26 CET 2016


Module: kamailio
Branch: master
Commit: 16c8d5e4648ff340e6043f4a38fd57c5c60a3058
URL: https://github.com/kamailio/kamailio/commit/16c8d5e4648ff340e6043f4a38fd57c5c60a3058

Author: jaybeepee <jason.penton at gmail.com>
Committer: jaybeepee <jason.penton at gmail.com>
Date: 2016-02-29T14:17:17+02:00

ims_dialog: fix small refcount bug

---

Modified: modules/ims_dialog/dlg_hash.c
Modified: modules/ims_dialog/dlg_req_within.c
Modified: modules/ims_dialog/ims_dialog.c

---

Diff:  https://github.com/kamailio/kamailio/commit/16c8d5e4648ff340e6043f4a38fd57c5c60a3058.diff
Patch: https://github.com/kamailio/kamailio/commit/16c8d5e4648ff340e6043f4a38fd57c5c60a3058.patch

---

diff --git a/modules/ims_dialog/dlg_hash.c b/modules/ims_dialog/dlg_hash.c
index 01a51f5..26817ac 100644
--- a/modules/ims_dialog/dlg_hash.c
+++ b/modules/ims_dialog/dlg_hash.c
@@ -1107,25 +1107,9 @@ void next_state_dlg(struct dlg_cell *dlg, int event,
             switch (dlg->state) {
                 case DLG_STATE_UNCONFIRMED:
                 case DLG_STATE_EARLY:
-//		    if (to_tag) {
-//                        LM_DBG("Going to check if there is another active branch - we only change state to DELETED if there are no other active branches\n");
-//                        while (dlg_out) {
-//                            if (dlg_out->to_tag.len == to_tag->len && memcmp(dlg_out->to_tag.s, to_tag->s, dlg_out->to_tag.len) == 0) {
-//                                dlg_out->deleted=1;
-//                            } else {
-//                                if (dlg_out->deleted != 1) {
-//                                    LM_DBG("Found a dlg_out (to-tag: [%.*s]) that is not for this event and is not in state deleted, therefore there is another active branch\n", to_tag->len, to_tag->s);
-//                                    delete = 0;
-//                                }
-//                            }
-//                            dlg_out = dlg_out->next;
-//                        }
-//                    }
-                    if (delete) {
-                        dlg->state = DLG_STATE_DELETED;
-                        unref_dlg_unsafe(dlg, 1, d_entry);
-                        *unref = 1;
-                    }
+					//					dlg->state = DLG_STATE_DELETED;
+					unref_dlg_unsafe(dlg, 1, d_entry);
+					//					*unref = 1;
                     break;
                 case DLG_STATE_CONFIRMED:
                 case DLG_STATE_CONFIRMED_NA:
diff --git a/modules/ims_dialog/dlg_req_within.c b/modules/ims_dialog/dlg_req_within.c
index e8b3ffd..b66ae6b 100644
--- a/modules/ims_dialog/dlg_req_within.c
+++ b/modules/ims_dialog/dlg_req_within.c
@@ -212,7 +212,7 @@ void bye_reply_cb(struct cell* t, int type, struct tmcb_params* ps) {
         run_dlg_callbacks(DLGCB_TERMINATED, dlg, ps->req, ps->rpl, DLG_DIR_NONE, 0);
 
         /* derefering the dialog */
-        unref_dlg(dlg, unref + 1);
+        unref_dlg(dlg, unref);		/*removed the extra +1 on the unref that is usually added in the unref of next_state_dlg */
     }
 
     if (new_state == DLG_STATE_DELETED && old_state == DLG_STATE_DELETED) {
diff --git a/modules/ims_dialog/ims_dialog.c b/modules/ims_dialog/ims_dialog.c
index 94c84e6..8fc37e7 100644
--- a/modules/ims_dialog/ims_dialog.c
+++ b/modules/ims_dialog/ims_dialog.c
@@ -130,7 +130,7 @@ static param_export_t mod_params[] = {
     { "default_timeout", INT_PARAM, &default_timeout},
     { "dlg_extra_hdrs", PARAM_STR, &dlg_extra_hdrs},
     //In this new dialog module we always match using DID
-    //{ "dlg_match_mode", INT_PARAM, &seq_match_mode},
+    { "dlg_match_mode", INT_PARAM, &seq_match_mode},
 
     { "db_url",				PARAM_STR, &db_url 				},
     { "db_mode",			INT_PARAM, &dlg_db_mode_param		},
@@ -943,7 +943,6 @@ static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) {
     if(rpc->scan(c, "*S", &rpc_extra_hdrs)<1)
     {
 	    rpc_extra_hdrs = dfl_rpc_extra_hdrs;
-	    rpc_extra_hdrs.len = 0;
     }
 
     dlg = lookup_dlg(h_entry, h_id);//increments ref count!




More information about the sr-dev mailing list