[sr-dev] git:master: dialog(k): destroy dlg structure first time ref counter gets to 0

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 22 11:32:09 CET 2011


Module: sip-router
Branch: master
Commit: 5949e296b7bafab42a4ac3261f453f286d98e41c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5949e296b7bafab42a4ac3261f453f286d98e41c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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

---

 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 a09e78f..0341143 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);\




More information about the sr-dev mailing list