[sr-dev] git:tmp/tm_async_reply_support: tm: fix memory bug where transaction not unrefed

Richard Good richard.good at smilecoms.com
Tue Mar 19 11:57:19 CET 2013


Module: sip-router
Branch: tmp/tm_async_reply_support
Commit: 15d013a5a09899989f7e321c45cafade3768e268
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=15d013a5a09899989f7e321c45cafade3768e268

Author: Richard Good <richard.good at smilecoms.com>
Committer: Richard Good <richard.good at smilecoms.com>
Date:   Tue Mar 19 12:56:09 2013 +0200

tm: fix memory bug where transaction not unrefed

	-Fixed memory bug in t_suspend.c where transaction must be unreffed.

---

 modules/tm/t_suspend.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/modules/tm/t_suspend.c b/modules/tm/t_suspend.c
index 565f624..4754f32 100644
--- a/modules/tm/t_suspend.c
+++ b/modules/tm/t_suspend.c
@@ -358,8 +358,15 @@ int t_continue(unsigned int hash_index, unsigned int label,
                             }
                             t->uac[branch].request.flags|=F_RB_REPLIED;
 //
-                            if (reply_status==RPS_ERROR)
-                                    goto done;
+                            if (reply_status==RPS_ERROR){
+                                LOG(L_DBG,"Unreffing the transaction");
+                                /* unref the transaction */
+                                t_unref(t->uac[branch].reply);
+
+                                sip_msg_free(t->uac[branch].reply);
+                                t->uac[branch].reply = 0;       
+                                goto done;
+                            }
 //
 //                            /* update FR/RETR timers on provisional replies */
                             
@@ -375,6 +382,12 @@ int t_continue(unsigned int hash_index, unsigned int label,
                                     t->uac[branch].request.flags|=F_RB_FR_INV; /* mark fr_inv */
                             } 
                             
+                            LOG(L_DBG,"Unreffing the transaction");
+                            /* unref the transaction */
+                            t_unref(t->uac[branch].reply);
+                            
+                            
+                            LOG(L_DBG,"Freeing earlier cloned reply");
                             sip_msg_free(t->uac[branch].reply);
                             t->uac[branch].reply = 0;
                                 
@@ -383,7 +396,7 @@ int t_continue(unsigned int hash_index, unsigned int label,
         }
 
 done:
-	return 0;
+        return 0;
 
 kill_trans:
 	/* The script has hopefully set the error code. If not,




More information about the sr-dev mailing list