summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-07-10 17:33:36 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-07-10 17:35:05 +0200
commitc379c948c75ebff18e85f0060aa13c78754523c1 (patch)
tree3bf6feb3f45eb3c7e055867a7aabc46932bfccc4
parentd6d575f47b6e9a2d20e740dc06b56f08d689d7c5 (diff)
downloadsocket_wrapper-c379c948c75ebff18e85f0060aa13c78754523c1.tar.gz
socket_wrapper-c379c948c75ebff18e85f0060aa13c78754523c1.tar.xz
socket_wrapper-c379c948c75ebff18e85f0060aa13c78754523c1.zip
src: Correctly allocalate and zero socket info.
-rw-r--r--src/socket_wrapper.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 51422ea..e9af3e5 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -1913,7 +1913,8 @@ static int swrap_socket(int family, int type, int protocol)
if (fd == -1) return -1;
- si = (struct socket_info *)calloc(1, sizeof(struct socket_info));
+ si = (struct socket_info *)malloc(sizeof(struct socket_info));
+ memset(si, 0, sizeof(struct socket_info));
if (si == NULL) {
errno = ENOMEM;
return -1;
@@ -2004,7 +2005,7 @@ static int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
}
child_si = (struct socket_info *)malloc(sizeof(struct socket_info));
- memset(child_si, 0, sizeof(*child_si));
+ memset(child_si, 0, sizeof(struct socket_info));
child_fi = (struct socket_info_fd *)calloc(1, sizeof(struct socket_info_fd));
if (child_fi == NULL) {