[sr-dev] git:master:cd379886: tm: proper resoring of backup lumps in case of cloning failure

Daniel-Constantin Mierla miconda at gmail.com
Thu Aug 1 13:55:20 CEST 2019


Module: kamailio
Branch: master
Commit: cd379886fa7a8ff01b9618491199f8e5b3ce897f
URL: https://github.com/kamailio/kamailio/commit/cd379886fa7a8ff01b9618491199f8e5b3ce897f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-08-01T13:54:21+02:00

tm: proper resoring of backup lumps in case of cloning failure

---

Modified: src/modules/tm/t_fwd.c

---

Diff:  https://github.com/kamailio/kamailio/commit/cd379886fa7a8ff01b9618491199f8e5b3ce897f.diff
Patch: https://github.com/kamailio/kamailio/commit/cd379886fa7a8ff01b9618491199f8e5b3ce897f.patch

---

diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
index 2ea1802389..ad1ec2dc15 100644
--- a/src/modules/tm/t_fwd.c
+++ b/src/modules/tm/t_fwd.c
@@ -199,14 +199,14 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 		i_req->add_rm = dup_lump_list(i_req->add_rm);
 		if (unlikely(i_req->add_rm==0)){
 			ret=E_OUT_OF_MEM;
-			goto error04;
+			goto error06;
 		}
 	}
 	if (unlikely(i_req->body_lumps)){
 		i_req->body_lumps = dup_lump_list(i_req->body_lumps);
 		if (unlikely(i_req->body_lumps==0)){
 			ret=E_OUT_OF_MEM;
-			goto error04;
+			goto error05;
 		}
 	}
 	/* backup uri & path: we need to change them so that build_req...()
@@ -593,12 +593,16 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
 	/* Delete the duplicated lump lists, this will also delete
 	 * all lumps created here, such as lumps created in per-branch
 	 * routing sections, Via, and Content-Length headers created in
-	 * build_req_buf_from_sip_req
+	 * build_req_buf_from_sip_req().
 	 */
 error04:
-	free_duped_lump_list(i_req->add_rm);
 	free_duped_lump_list(i_req->body_lumps);
-	/* Restore the lists from backups */
+
+error05:
+	free_duped_lump_list(i_req->add_rm);
+
+error06:
+	/* Restore the lists from backups. */
 	i_req->add_rm = add_rm_backup;
 	i_req->body_lumps = body_lumps_backup;
 




More information about the sr-dev mailing list