浏览代码

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

- Found and fixed by Hugh Waite @ Crocodile RCS
Peter Dunkley 13 年之前
父节点
当前提交
9b77e69de0
共有 1 个文件被更改,包括 7 次插入9 次删除
  1. 7 9
      modules_k/rls/rls_db.c

+ 7 - 9
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);
 		}