Module: sip-router
Branch: 3.1
Commit: cfb85a6064592f491edf17bf6500618f279aaa05
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cfb85a6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Nov 22 11:30:56 2011 +0100
dialog(k): destroy dlg structure first time ref counter gets to 0
- reported by Bayan Towfix, FS#173
(cherry picked from commit 5949e296b7bafab42a4ac3261f453f286d98e41c)
(cherry picked from commit ae248a3744ab06a61c962415a8ac55a9c53fba82)
---
modules_k/dialog/dlg_hash.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/modules_k/dialog/dlg_hash.c b/modules_k/dialog/dlg_hash.c
index 03754c0..9242bbc 100644
--- a/modules_k/dialog/dlg_hash.c
+++ b/modules_k/dialog/dlg_hash.c
@@ -92,6 +92,11 @@ struct dlg_table *d_table = 0;
*/
#define unref_dlg_unsafe(_dlg,_cnt,_d_entry) \
do { \
+ if((_dlg)->ref <= 0 ) { \
+ LM_WARN("invalid unref'ing dlg %p with ref %d by %d\n",\
+ (_dlg),(_dlg)->ref,(_cnt));\
+ break; \
+ } \
(_dlg)->ref -= (_cnt); \
LM_DBG("unref dlg %p with %d -> %d\n",\
(_dlg),(_cnt),(_dlg)->ref);\