Преглед на файлове

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

Daniel-Constantin Mierla преди 6 години
родител
ревизия
cd379886fa
променени са 1 файла, в които са добавени 9 реда и са изтрити 5 реда
  1. 9 5
      src/modules/tm/t_fwd.c

+ 9 - 5
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 @@ error03:
 	/* 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;