fixes memory leak in failed cttp.c address resolution

This commit is contained in:
Joe Bryan 2018-06-05 16:21:08 -04:00
parent 59a049b170
commit f5867bfad5

View File

@ -829,21 +829,22 @@ _cttp_creq_resolve_cb(uv_getaddrinfo_t* adr_u,
u3_creq* ceq_u = adr_u->data;
if ( u3_csat_quit == ceq_u->sat_e ) {
return _cttp_creq_quit(ceq_u);;
_cttp_creq_quit(ceq_u);;
}
if ( 0 != sas_i ) {
return _cttp_creq_fail(ceq_u, uv_strerror(sas_i));
else if ( 0 != sas_i ) {
_cttp_creq_fail(ceq_u, uv_strerror(sas_i));
}
else {
// XX traverse struct a la _ames_czar_cb
ceq_u->ipf_w = ntohl(((struct sockaddr_in *)aif_u->ai_addr)->sin_addr.s_addr);
ceq_u->ipf_c = _cttp_creq_ip(ceq_u->ipf_w);
ceq_u->ipf_w = ntohl(((struct sockaddr_in *)aif_u->ai_addr)->sin_addr.s_addr);
ceq_u->ipf_c = _cttp_creq_ip(ceq_u->ipf_w);
ceq_u->sat_e = u3_csat_ripe;
_cttp_creq_connect(ceq_u);
}
free(adr_u);
uv_freeaddrinfo(aif_u);
ceq_u->sat_e = u3_csat_ripe;
_cttp_creq_connect(ceq_u);
}
/* _cttp_creq_resolve(): resolve hostname to IP address
@ -864,6 +865,7 @@ _cttp_creq_resolve(u3_creq* ceq_u)
hin_u.ai_socktype = SOCK_STREAM;
hin_u.ai_protocol = IPPROTO_TCP;
// XX is this necessary?
c3_c* por_c = ceq_u->por_c ? ceq_u->por_c :
( c3y == ceq_u->sec ) ? "443" : "80";