diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 02a2f143..d7691754 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -2062,7 +2062,7 @@ internal_add_connection (struct MHD_Daemon *daemon, | |||
2062 | return MHD_NO; | 2062 | return MHD_NO; |
2063 | } | 2063 | } |
2064 | 2064 | ||
2065 | if (NULL == (connection = malloc (sizeof (struct MHD_Connection)))) | 2065 | if (NULL == (connection = MHD_calloc_ (1, sizeof (struct MHD_Connection)))) |
2066 | { | 2066 | { |
2067 | eno = errno; | 2067 | eno = errno; |
2068 | #ifdef HAVE_MESSAGES | 2068 | #ifdef HAVE_MESSAGES |
@@ -2077,9 +2077,6 @@ internal_add_connection (struct MHD_Daemon *daemon, | |||
2077 | errno = eno; | 2077 | errno = eno; |
2078 | return MHD_NO; | 2078 | return MHD_NO; |
2079 | } | 2079 | } |
2080 | memset (connection, | ||
2081 | 0, | ||
2082 | sizeof (struct MHD_Connection)); | ||
2083 | connection->pool = MHD_pool_create (daemon->pool_size); | 2080 | connection->pool = MHD_pool_create (daemon->pool_size); |
2084 | if (NULL == connection->pool) | 2081 | if (NULL == connection->pool) |
2085 | { | 2082 | { |
@@ -3248,7 +3245,7 @@ MHD_poll_all (struct MHD_Daemon *daemon, | |||
3248 | int poll_itc_idx; | 3245 | int poll_itc_idx; |
3249 | struct pollfd *p; | 3246 | struct pollfd *p; |
3250 | 3247 | ||
3251 | p = malloc (sizeof (struct pollfd) * (2 + num_connections)); | 3248 | p = MHD_calloc_ ((2 + num_connections), sizeof (struct pollfd)); |
3252 | if (NULL == p) | 3249 | if (NULL == p) |
3253 | { | 3250 | { |
3254 | #ifdef HAVE_MESSAGES | 3251 | #ifdef HAVE_MESSAGES |
@@ -3258,9 +3255,6 @@ MHD_poll_all (struct MHD_Daemon *daemon, | |||
3258 | #endif | 3255 | #endif |
3259 | return MHD_NO; | 3256 | return MHD_NO; |
3260 | } | 3257 | } |
3261 | memset (p, | ||
3262 | 0, | ||
3263 | sizeof (struct pollfd) * (2 + num_connections)); | ||
3264 | poll_server = 0; | 3258 | poll_server = 0; |
3265 | poll_listen = -1; | 3259 | poll_listen = -1; |
3266 | if ( (MHD_INVALID_SOCKET != daemon->socket_fd) && | 3260 | if ( (MHD_INVALID_SOCKET != daemon->socket_fd) && |
@@ -4746,11 +4740,8 @@ MHD_start_daemon_va (unsigned int flags, | |||
4746 | } | 4740 | } |
4747 | if (NULL == dh) | 4741 | if (NULL == dh) |
4748 | return NULL; | 4742 | return NULL; |
4749 | if (NULL == (daemon = malloc (sizeof (struct MHD_Daemon)))) | 4743 | if (NULL == (daemon = MHD_calloc_ (1, sizeof (struct MHD_Daemon)))) |
4750 | return NULL; | 4744 | return NULL; |
4751 | memset (daemon, | ||
4752 | 0, | ||
4753 | sizeof (struct MHD_Daemon)); | ||
4754 | #ifdef EPOLL_SUPPORT | 4745 | #ifdef EPOLL_SUPPORT |
4755 | daemon->epoll_fd = -1; | 4746 | daemon->epoll_fd = -1; |
4756 | #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) | 4747 | #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) |