From cd379886fa7a8ff01b9618491199f8e5b3ce897f Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 1 Aug 2019 13:54:21 +0200 Subject: [PATCH] tm: proper resoring of backup lumps in case of cloning failure --- src/modules/tm/t_fwd.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c index 2ea1802389d..ad1ec2dc153 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;