summaryrefslogtreecommitdiff
path: root/src/ivysocket.c
diff options
context:
space:
mode:
authorfcolin2010-03-02 16:47:15 +0000
committerfcolin2010-03-02 16:47:15 +0000
commitb9ed5fcd5d6e499b054553c351c02d27150de90c (patch)
tree55fb15e373e249dff6de2d4cd760813af38bd588 /src/ivysocket.c
parent8bccd9a60dd7601bfe79b959500a44aa9733588a (diff)
downloadivy-c-b9ed5fcd5d6e499b054553c351c02d27150de90c.zip
ivy-c-b9ed5fcd5d6e499b054553c351c02d27150de90c.tar.gz
ivy-c-b9ed5fcd5d6e499b054553c351c02d27150de90c.tar.bz2
ivy-c-b9ed5fcd5d6e499b054553c351c02d27150de90c.tar.xz
Cleanup memory
Diffstat (limited to 'src/ivysocket.c')
-rw-r--r--src/ivysocket.c8
1 files changed, 6 insertions, 2 deletions
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 */