summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Roberto Urio <paulourio@gmail.com>2012-06-04 10:52:19 +0800
committerAndy Green <andy.green@linaro.org>2012-06-04 10:52:19 +0800
commit1e326638056aa499ecdcc4b94adcd674043c9c5b (patch)
treefc8cc9135fca67fc7d28e29ca58b1c2554e8fdc1
parent4144e83c9df1612c0549e80f982b88e210515158 (diff)
Fixing uninitialised memory
These were found with valgrind tool. Signed-off-by: Paulo Roberto Urio <paulourio@gmail.com>
-rw-r--r--lib/libwebsockets.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 6f93778..06f5c06 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -2514,7 +2514,7 @@ libwebsocket_create_context(int port, const char *interf,
struct libwebsocket_context *context = NULL;
unsigned int slen;
char *p;
- char hostname[1024];
+ char hostname[1024] = "";
// struct hostent *he;
struct libwebsocket *wsi;
struct sockaddr sa;
@@ -2566,6 +2566,7 @@ libwebsocket_create_context(int port, const char *interf,
context->options = options;
context->fds_count = 0;
context->extensions = extensions;
+ context->last_timeout_check_s = 0;
#ifdef WIN32
context->fd_random = 0;
@@ -2587,6 +2588,7 @@ libwebsocket_create_context(int port, const char *interf,
/* find canonical hostname */
hostname[(sizeof hostname) - 1] = '\0';
+ memset(&sa, 0, sizeof(sa));
sa.sa_family = AF_INET;
sa.sa_data[(sizeof sa.sa_data) - 1] = '\0';
gethostname(hostname, (sizeof hostname) - 1);