From b9ed5fcd5d6e499b054553c351c02d27150de90c Mon Sep 17 00:00:00 2001 From: fcolin Date: Tue, 2 Mar 2010 16:47:15 +0000 Subject: Cleanup memory --- src/ivysocket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/ivysocket.c') diff --git a/src/ivysocket.c b/src/ivysocket.c index bf1b76c..9584807 100644 --- a/src/ivysocket.c +++ b/src/ivysocket.c @@ -806,11 +806,12 @@ Client SocketBroadcastCreate (unsigned short port, struct sockaddr_in local; int on = 1; + memset( &local,0,sizeof(local) ); local.sin_family = AF_INET; local.sin_addr.s_addr = INADDR_ANY; local.sin_port = htons (port); - if ((handle = socket (AF_INET, SOCK_DGRAM, 0)) < 0){ + if ((handle = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0){ perror ("*** dgram socket ***"); return NULL; }; @@ -885,7 +886,9 @@ void SocketSendBroadcast (Client client, unsigned long host, unsigned short port va_start (ap, fmt ); buffer.offset = 0; len = make_message (&buffer, fmt, ap ); + va_end (ap ); /* Send UDP packet to the dest */ + memset( &remote,0,sizeof(remote) ); remote.sin_family = AF_INET; remote.sin_addr.s_addr = htonl (host ); remote.sin_port = htons(port); @@ -894,7 +897,8 @@ void SocketSendBroadcast (Client client, unsigned long host, unsigned short port (struct sockaddr *)&remote,sizeof(remote)); if (err != len) { perror ("*** send ***"); - } va_end (ap ); + } + } /* Socket Multicast */ -- cgit v1.1