From c379c948c75ebff18e85f0060aa13c78754523c1 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 10 Jul 2013 17:33:36 +0200 Subject: src: Correctly allocalate and zero socket info. --- src/socket_wrapper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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) { -- cgit