if(!dotth && !strncmp(p, "TTH:", 4))
{
dotth = 1;
- if((buf = base32decode(p + 4, &buflen)) == NULL)
- goto out;
- if(buflen != 24)
+ if(((buf = base32decode(p + 4, &buflen)) == NULL) || (buflen != 24))
+ {
+ free(buf);
goto out;
+ }
memcpy(hashtth, buf, 24);
free(buf);
} else {
if(tcpsock == NULL)
return;
- if(sockgetremotename(tcpsock, &addr, &addrlen) < 0)
+ if(sockgetremotename(sk, &addr, &addrlen) < 0)
return;
if(addr->sa_family == AF_INET)
qstrf(sk, "$ConnectToMe %s %s|", nick, formataddress(addr, addrlen));
addtobuf(sstr, 0);
if(tcpsock != NULL)
{
- if(sockgetremotename(udpsock, &name, &namelen) < 0)
+ if(sockgetremotename(fn->sk, &name, &namelen) < 0)
{
flog(LOG_WARNING, "cannot get address of UDP socket");
} else {