From 6348f3f2c762adbab2d2d576f1a6e7a44ee534d6 Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 31 Oct 2012 13:26:03 -0700 Subject: [PATCH] fix valgrind uninit warning on dtls setsockopt --- src/io.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/io.c b/src/io.c index ad9fe4fd2..2dba2a0dd 100644 --- a/src/io.c +++ b/src/io.c @@ -152,7 +152,9 @@ int EmbedReceive(CYASSL *ssl, char *buf, int sz, void *ctx) #ifdef USE_WINDOWS_API DWORD timeout = dtls_timeout * 1000; #else - struct timeval timeout = {dtls_timeout, 0}; + struct timeval timeout; + XMEMSET(&timeout, 0, sizeof(struct timeval)); + timeout.tv_sec = dtls_timeout; #endif setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout)); @@ -275,7 +277,9 @@ int EmbedReceiveFrom(CYASSL *ssl, char *buf, int sz, void *ctx) #ifdef USE_WINDOWS_API DWORD timeout = dtls_timeout * 1000; #else - struct timeval timeout = {dtls_timeout, 0}; + struct timeval timeout; + XMEMSET(&timeout, 0, sizeof(struct timeval)); + timeout.tv_sec = dtls_timeout; #endif setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout));