1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-22 17:22:18 -05:00

Supposed fix for identd ipv6 compiler warnings

This commit is contained in:
Berke Viktor 2012-10-30 20:57:49 +01:00
parent f6c2698701
commit 284dbfbe3d

View File

@ -82,6 +82,7 @@ identd (char *username)
} }
#ifdef USE_IPV6 #ifdef USE_IPV6
#define IPV6BUFLEN 60
static int static int
identd_ipv6 (char *username) identd_ipv6 (char *username)
{ {
@ -89,8 +90,7 @@ identd_ipv6 (char *username)
char *p; char *p;
char buf[256]; char buf[256];
char outbuf[256]; char outbuf[256];
char ipv6buf[60]; LPSTR ipv6buf = (LPSTR) malloc (IPV6BUFLEN);
DWORD ipv6buflen = sizeof (ipv6buf);
struct sockaddr_in6 addr; struct sockaddr_in6 addr;
sok = socket (AF_INET6, SOCK_STREAM, 0); sok = socket (AF_INET6, SOCK_STREAM, 0);
@ -98,6 +98,7 @@ identd_ipv6 (char *username)
if (sok == INVALID_SOCKET) if (sok == INVALID_SOCKET)
{ {
free (username); free (username);
free (ipv6buf);
return 0; return 0;
} }
@ -112,6 +113,7 @@ identd_ipv6 (char *username)
{ {
closesocket (sok); closesocket (sok);
free (username); free (username);
free (ipv6buf);
return 0; return 0;
} }
@ -119,6 +121,7 @@ identd_ipv6 (char *username)
{ {
closesocket (sok); closesocket (sok);
free (username); free (username);
free (ipv6buf);
return 0; return 0;
} }
@ -129,12 +132,13 @@ identd_ipv6 (char *username)
if (read_sok == INVALID_SOCKET) if (read_sok == INVALID_SOCKET)
{ {
free (username); free (username);
free (ipv6buf);
return 0; return 0;
} }
identd_ipv6_is_running = FALSE; identd_ipv6_is_running = FALSE;
if (WSAAddressToString ((struct sockaddr *) &addr, sizeof (addr), NULL, &ipv6buf, &ipv6buflen) == SOCKET_ERROR) if (WSAAddressToString ((struct sockaddr *) &addr, sizeof (addr), NULL, ipv6buf, (LPDWORD) IPV6BUFLEN) == SOCKET_ERROR)
{ {
snprintf (ipv6buf, sizeof (ipv6buf) - 1, "[SOCKET ERROR: 0x%X]", WSAGetLastError ()); snprintf (ipv6buf, sizeof (ipv6buf) - 1, "[SOCKET ERROR: 0x%X]", WSAGetLastError ());
} }
@ -157,6 +161,7 @@ identd_ipv6 (char *username)
sleep (1); sleep (1);
closesocket (read_sok); closesocket (read_sok);
free (username); free (username);
free (ipv6buf);
return 0; return 0;
} }