rem: free( buf ) ;
add: pkg_free( buf ) ;
context: int t_send_reply(  struct sip_msg* p_msg , unsigned int code , char * text ){	unsigned int len, buf_len;	char * buf, *shbuf;	struct retrans_buff *rb;	buf = build_res_buf_from_sip_req(code,text,T->tag->s,T->tag->len,		T->inbound_request,&len);	DBG("DEBUG: t_send_reply: buffer computed\n");	if (!buf)	{		DBG("DEBUG: t_send_reply: response building failed\n");		goto error;	}	LOCK_REPLIES( T );	rb = & T->outbound_response;	if (!rb->retr_buffer) {		/* initialize retransmission structure */		memset( rb , 0 , sizeof (struct retrans_buff) );		if (update_sock_struct_from_via(  &(rb->to),  p_msg->via1 )==-1)		{			UNLOCK_REPLIES( T );			LOG(L_ERR, "ERROR: t_send_reply: cannot lookup reply dst: %s\n",				p_msg->via1->host.s );			goto error2;		}		rb->retr_timer.tg=TG_RT;		rb->fr_timer.tg=TG_FR;		rb->retr_timer.payload = rb;		rb->fr_timer.payload = rb;		rb->to.sin_family = AF_INET;		rb->my_T = T;		rb->status = code;	}	/* if this is a first reply (?100), longer replies will probably follow;	   try avoiding shm_resize by higher buffer size */	buf_len = rb->retr_buffer ? len : len + REPLY_OVERBUFFER_LEN;	if (! (rb->retr_buffer = (char*)shm_resize( rb->retr_buffer, buf_len )))	{		UNLOCK_REPLIES( T );		LOG(L_ERR, "ERROR: t_send_reply: cannot allocate shmem buffer\n");		goto error2;	}	rb->bufflen = len ;	memcpy( rb->retr_buffer , buf , len );	T->status = code;	/* needs to be protected too because what timers are set depends	   on current transactions status */	t_update_timers_after_sending_reply( rb );	UNLOCK_REPLIES( T );	SEND_PR_BUFFER( rb, buf, len );	free( buf ) ;	/* start/stops the proper timers*/	DBG("DEBUG: t_send_reply: finished\n");	return 1;error2:	free ( buf );error:	return -1;}