[sr-dev] git:3.3: modules_k/rls: Some incorrect pkg_free() calls in DB only code

Peter Dunkley peter.dunkley at crocodile-rcs.com
Tue Aug 21 16:23:15 CEST 2012


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

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Tue Aug 21 15:21:54 2012 +0100

modules_k/rls: Some incorrect pkg_free() calls in DB only code

- Found and fixed by Hugh Waite @ Crocodile RCS
(cherry picked from commit 9b77e69de0953f9f6f48d4c1cf06f7e593469912)

---

 modules_k/rls/rls_db.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/modules_k/rls/rls_db.c b/modules_k/rls/rls_db.c
index 052a0e7..97ac7d6 100644
--- a/modules_k/rls/rls_db.c
+++ b/modules_k/rls/rls_db.c
@@ -798,6 +798,13 @@ int get_dialog_subscribe_rlsdb(subs_t *subs)
 	r_version = VAL_INT(&values[version_col]);
 	r_record_route = (char *)VAL_STRING(&values[rroute_col]);
 
+	if ( r_remote_cseq >= subs->remote_cseq)
+	{
+		LM_DBG("stored cseq= %d\n", r_remote_cseq);
+		rls_dbf.free_result(rls_db, result);
+		return(401); /*stale cseq code */
+	}
+
 	if(strlen(r_pres_uri) > 0)
 	{
 		subs->pres_uri.s =
@@ -805,7 +812,6 @@ int get_dialog_subscribe_rlsdb(subs_t *subs)
 		if(subs->pres_uri.s==NULL)
 		{
 			LM_ERR( "Out of Memory\n" );
- 			pkg_free(subs->pres_uri.s);
 			rls_dbf.free_result(rls_db, result);
 			return(-1);
 		}
@@ -814,13 +820,6 @@ int get_dialog_subscribe_rlsdb(subs_t *subs)
 		subs->pres_uri.len= strlen(r_pres_uri);
 	}
 
-	if ( r_remote_cseq >= subs->remote_cseq)
-	{
-		LM_DBG("stored cseq= %d\n", r_remote_cseq);
-		rls_dbf.free_result(rls_db, result);
-		return(401); /*stale cseq code */
-	}
-
 	if(strlen(r_record_route) > 0)
 	{
 		subs->record_route.s =
@@ -828,7 +827,6 @@ int get_dialog_subscribe_rlsdb(subs_t *subs)
 		if(subs->record_route.s==NULL)
 		{
 			LM_ERR( "Out of Memory\n" );
- 			pkg_free(subs->record_route.s);
 			rls_dbf.free_result(rls_db, result);
 			return(-1);
 		}




More information about the sr-dev mailing list