Skip to content

Commit

Permalink
tm: proper resoring of backup lumps in case of cloning failure
Browse files Browse the repository at this point in the history
(cherry picked from commit cd37988)
  • Loading branch information
miconda committed Aug 12, 2019
1 parent 164702d commit 5c042d6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/modules/tm/t_fwd.c
Expand Up @@ -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...()
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 5c042d6

Please sign in to comment.