|
@@ -92,6 +92,8 @@
|
|
|
* 2009-06-01 Pre- and post-script callbacks of branch route are
|
|
|
* executed (Miklos)
|
|
|
* 2009-12-10 reply route is executed under lock to protect the avps (andrei)
|
|
|
+ * 2010-02-22 _reply() will cleanup any reply lumps that it might have added
|
|
|
+ * (andrei)
|
|
|
*
|
|
|
*/
|
|
|
|
|
@@ -653,7 +655,9 @@ static int _reply( struct cell *trans, struct sip_msg* p_msg,
|
|
|
char * buf, *dset;
|
|
|
struct bookmark bm;
|
|
|
int dset_len;
|
|
|
+ struct lump_rpl* rpl_l;
|
|
|
|
|
|
+ rpl_l=0;
|
|
|
if (code>=200) set_kr(REQ_RPLD);
|
|
|
/* compute the buffer in private memory prior to entering lock;
|
|
|
* create to-tag if needed */
|
|
@@ -671,12 +675,19 @@ static int _reply( struct cell *trans, struct sip_msg* p_msg,
|
|
|
|| get_to(p_msg)->tag_value.len==0)) {
|
|
|
calc_crc_suffix( p_msg, tm_tag_suffix );
|
|
|
buf = build_res_buf_from_sip_req(code,text, &tm_tag, p_msg, &len, &bm);
|
|
|
+ if (unlikely(rpl_l)){
|
|
|
+ unlink_lump_rpl(p_msg, rpl_l);
|
|
|
+ free_lump_rpl(rpl_l);
|
|
|
+ }
|
|
|
return _reply_light( trans, buf, len, code, text,
|
|
|
tm_tag.s, TOTAG_VALUE_LEN, lock, &bm);
|
|
|
} else {
|
|
|
buf = build_res_buf_from_sip_req(code,text, 0 /*no to-tag*/,
|
|
|
p_msg, &len, &bm);
|
|
|
-
|
|
|
+ if (unlikely(rpl_l)){
|
|
|
+ unlink_lump_rpl(p_msg, rpl_l);
|
|
|
+ free_lump_rpl(rpl_l);
|
|
|
+ }
|
|
|
return _reply_light(trans,buf,len,code,text,
|
|
|
0, 0, /* no to-tag */lock, &bm);
|
|
|
}
|