rem: he=gethostbyname(via->host.s);
add: if (!(host_copy=pkg_malloc( via->host.len+1 ))) { LOG(L_NOTICE, "ERROR: update_sock_struct_from_via: not enough memory\n"); return -1; } memcpy(host_copy, via->host.s, via->host.len ); host_copy[via->host.len]=0; he=gethostbyname(host_copy);  pkg_free( host_copy );
context: int update_sock_struct_from_via( struct sockaddr_in* to,  struct via_body* via ){	int err;	struct hostent* he;	to->sin_family = AF_INET;	to->sin_port = (via->port)?htons(via->port): htons(SIP_PORT);#ifdef DNS_IP_HACK	to->sin_addr.s_addr=str2ip((unsigned char*)via->host.s,via->host.len,&err);	if (err)#endif	{		/* fork? gethostbyname will probably block... */		he=gethostbyname(via->host.s);		if (he==0){			LOG(L_NOTICE, "ERROR:forward_reply:gethostbyname(%s) failure\n",					via->host.s);			return -1;		}		memcpy(&(to->sin_addr.s_addr), he->h_addr_list[0], 				sizeof(to->sin_addr.s_addr));		/*		to->sin_addr.s_addr=*((long*)he->h_addr_list[0]);		*/	}	return 1;}