rem: re->host.h_aliases[i]=(char*)malloc(len2);
add: re->host.h_aliases[i]=(char*)malloc(sizeof(char)*len2);
context: int add_rule(struct cfg_line* cl, struct route_elem** head){		struct route_elem* re;	struct hostent * he;	int ret;	int i,len, len2;	re=init_re();	if (re==0) return E_OUT_OF_MEM;	if (regcomp(&(re->method), cl->method, REG_EXTENDED|REG_NOSUB|REG_ICASE)){		DPrint("ERROR: bad re \"%s\"\n", cl->method);		ret=E_BAD_RE;		goto error;	}	if (regcomp(&(re->uri), cl->uri, REG_EXTENDED|REG_NOSUB|REG_ICASE) ){		DPrint("ERROR: bad re \"%s\"\n", cl->uri);		ret=E_BAD_RE;		goto error;	}		he=gethostbyname(cl->address);	if (he==0){		DPrint("ERROR: cannot resolve \"%s\"\n", cl->address);		ret=E_BAD_ADDRESS;		goto error;	}		/* start copying the host entry.. */	/* copy h_name */	len=strlen(he->h_name)+1;	re->host.h_name=(char*)malloc(len);	if (re->host.h_name) strncpy(re->host.h_name, he->h_name, len);	else{		ret=E_OUT_OF_MEM;		goto error;	}	/* copy h_aliases */	for (len=0;he->h_aliases[len];len++);	re->host.h_aliases=(char**)malloc(len+1);	if (re->host.h_aliases==0){		ret=E_OUT_OF_MEM;		goto error;	}	memset((void*)re->host.h_aliases, 0, sizeof(char*) * (len+1) );	for (i=0;i<len;i++){		len2=strlen(he->h_aliases[i])+1;		re->host.h_aliases[i]=(char*)malloc(len2);		if (re->host.h_aliases==0){			ret=E_OUT_OF_MEM;			goto error;		}		strncpy(re->host.h_aliases[i], he->h_aliases[i], len2);	}	/* copy h_addr_list */	for (len=0;he->h_addr_list[len];len++);	re->host.h_addr_list=(char**)malloc(len+1);	if (re->host.h_addr_list==0){		ret=E_OUT_OF_MEM;		goto error;	}	memset((void*)re->host.h_addr_list, 0, sizeof(char*) * (len+1) );	for (i=0;i<len;i++){		re->host.h_addr_list[i]=(char*)malloc(he->h_length+1);		if (re->host.h_addr_list==0){			ret=E_OUT_OF_MEM;			goto error;		}		memcpy(re->host.h_addr_list[i], he->h_addr_list[i], he->h_length+1);	}	/* copy h_addr_type & length */	re->host.h_addrtype=he->h_addrtype;	re->host.h_length=he->h_length;	/*finished hostent copy */		re->port=cl->port;	re->current_addr_idx=0;	re->ok=1;	push(re,head);	return 0;	error:		free_re(re);		return ret;}