Module: sip-router
Branch: 4.1
Commit: 8c7aa83346e18792d9a622c63c83cff81dcc144b
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8c7aa83…
Author: Jason Penton <jason.penton(a)smilecoms.com>
Committer: Jason Penton <jason.penton(a)smilecoms.com>
Date: Wed Nov 13 15:12:48 2013 +0200
modules/dialog_ng: fixed double shm memory free
- happens when calling get_dlg function from cfg file
---
modules/dialog_ng/dialog.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/modules/dialog_ng/dialog.c b/modules/dialog_ng/dialog.c
index 4e1b547..078d198 100644
--- a/modules/dialog_ng/dialog.c
+++ b/modules/dialog_ng/dialog.c
@@ -306,11 +306,17 @@ static int w_dlg_get(struct sip_msg *msg, char *ci, char *ft, char
*tt)
dlg = get_dlg(&sc, &sf, &st, &dir);
if(dlg==NULL)
return -1;
-
- unref_dlg(dlg, 1);
- set_current_dialog(msg, dlg);
- _dlg_ctx.dlg = dlg;
- _dlg_ctx.dir = dir;
+
+ /*
+ note: we should unref the dlg here (from get_dlg). BUT, because we are setting the
current dialog
+ we can ignore the unref... instead of unreffing and reffing again for the
set_current_dialog. NB.
+ this function is generally called from the cfg file. If used via API, remember to unref
the dlg
+ afterwards
+ */
+
+ set_current_dialog(msg, dlg);
+ _dlg_ctx.dlg = dlg;
+ _dlg_ctx.dir = dir;
return 1;
}