rem: char *tmp; int uri_len = 0, user_len = 0;
add: struct action act; if(msg==NULL || d==NULL) { LOG(L_ERR, "PDT:update_new_uri: bad parameters\n"); return -1; }
context: int update_new_uri(struct sip_msg *msg, int code_len, char* host_port){	char *tmp;	int uri_len = 0, user_len = 0; 		/* flag to show that ruri is not parsed */	msg->parsed_uri_ok = 0;	/* compute the new uri length */	uri_len = 4/*sip:*/ + msg->parsed_uri.user.len-code_len +			( msg->parsed_uri.passwd.len ? msg->parsed_uri.passwd.len + 1:0 ) + 			strlen(host_port) + 1/*@*/ +			(msg->parsed_uri.params.len ? msg->parsed_uri.params.len + 1:0 ) +			(msg->parsed_uri.headers.len ? msg->parsed_uri.headers.len + 1:0 );		if (uri_len > MAX_URI_SIZE) 	{		LOG(L_ERR, "PDT: update_new_uri(): uri is too long\n");		return -1;	}	/* space for the new uri */	tmp = (char*)pkg_malloc(uri_len+1);	if(tmp == NULL)		{		LOG(L_ERR, "PDT: update_new_uri: error allocating space\n");		return -1;	}	/* construct the new uri */	strcpy(tmp, "sip:");		/* add user part */	user_len = msg->parsed_uri.user.len-code_len;	strncat(tmp, msg->parsed_uri.user.s+code_len, user_len);	/* add password, if that exists */	if(msg->parsed_uri.passwd.s && msg->parsed_uri.passwd.len > 0)	{		strcat(tmp, ":");		strncat(tmp, msg->parsed_uri.passwd.s, 				msg->parsed_uri.passwd.len);	}	strcat(tmp,"@");		/* add host(and port) part of the uri */	strcat(tmp, host_port);	if(msg->parsed_uri.params.s && msg->parsed_uri.params.len > 0)	{		strcat(tmp, ";");		strncat(tmp, msg->parsed_uri.params.s, msg->parsed_uri.params.len);	}		if(msg->parsed_uri.headers.s && msg->parsed_uri.headers.len > 0)	{		strcat(tmp, "?");		strncat(tmp, msg->parsed_uri.headers.s, msg->parsed_uri.headers.len);	}		/* free space of the old new_uri */	if(msg->new_uri.s)	{		pkg_free(msg->new_uri.s);		msg->new_uri.len = 0;	}		/* setup the new uri */	msg->new_uri.s = tmp;	msg->new_uri.len = uri_len;	// here to clear		DBG("PDT: update_new_uri: len=%d uri=%.*s\n", msg->new_uri.len, 			msg->new_uri.len, msg->new_uri.s);		return 0;}