Commit 717b6968 authored by Kai Vehmanen's avatar Kai Vehmanen

Fixed issues reported by valgrind - mostly use of uninitialized variables.

darcs-hash:20070521153414-77cd4-67a6d3f55d74a3fe60da7b3329f633838cc6b84d.gz
parent b11a9ecc
...@@ -45,9 +45,10 @@ main (void) ...@@ -45,9 +45,10 @@ main (void)
NiceUDPSocketFactory factory; NiceUDPSocketFactory factory;
NiceUDPSocket server; NiceUDPSocket server;
NiceUDPSocket client; NiceUDPSocket client;
NiceAddress tmp = {0,}; NiceAddress tmp;
gchar buf[5]; gchar buf[5];
memset (&tmp, 0, sizeof (tmp));
nice_udp_bsd_socket_factory_init (&factory); nice_udp_bsd_socket_factory_init (&factory);
g_assert (nice_udp_socket_factory_make (&factory, &server, NULL)); g_assert (nice_udp_socket_factory_make (&factory, &server, NULL));
......
...@@ -45,10 +45,11 @@ main (void) ...@@ -45,10 +45,11 @@ main (void)
{ {
NiceUDPSocketFactory man; NiceUDPSocketFactory man;
NiceUDPSocket sock; NiceUDPSocket sock;
NiceAddress addr = {0,}; NiceAddress addr;
guint len; guint len;
gchar buf[1024]; gchar buf[1024];
memset (&addr, 0, sizeof (addr));
nice_udp_fake_socket_factory_init (&man); nice_udp_fake_socket_factory_init (&man);
memset (buf, '\0', 1024); memset (buf, '\0', 1024);
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include "udp-bsd.h" #include "udp-bsd.h"
...@@ -56,9 +57,10 @@ socket_recv ( ...@@ -56,9 +57,10 @@ socket_recv (
gchar *buf) gchar *buf)
{ {
gint recvd; gint recvd;
struct sockaddr_in sin = {0,}; struct sockaddr_in sin;
guint from_len = sizeof (sin); guint from_len = sizeof (sin);
memset (&sin, 0, sizeof (sin));
recvd = recvfrom (sock->fileno, buf, len, 0, (struct sockaddr *) &sin, recvd = recvfrom (sock->fileno, buf, len, 0, (struct sockaddr *) &sin,
&from_len); &from_len);
...@@ -102,9 +104,10 @@ socket_factory_init_socket ( ...@@ -102,9 +104,10 @@ socket_factory_init_socket (
NiceAddress *addr) NiceAddress *addr)
{ {
gint sockfd; gint sockfd;
struct sockaddr_in name = {0,}; struct sockaddr_in name;
guint name_len = sizeof (name); guint name_len = sizeof (name);
memset (&name, 0, sizeof (name));
sockfd = socket (PF_INET, SOCK_DGRAM, 0); sockfd = socket (PF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) if (sockfd < 0)
......
...@@ -36,14 +36,16 @@ ...@@ -36,14 +36,16 @@
*/ */
#include "udp-bsd.h" #include "udp-bsd.h"
#include <string.h>
gint gint
main (void) main (void)
{ {
NiceUDPSocketFactory factory; NiceUDPSocketFactory factory;
NiceUDPSocket sock; NiceUDPSocket sock;
NiceAddress addr = {0,}; NiceAddress addr;
memset (&addr, 0, sizeof (addr));
nice_udp_bsd_socket_factory_init (&factory); nice_udp_bsd_socket_factory_init (&factory);
addr.port = 9999; addr.port = 9999;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment