Fix a bug : bad size for sockets malloc

This commit is contained in:
Grégory Soutadé 2016-02-04 20:39:50 +01:00
parent 93f45dab81
commit 54184da72c

View File

@ -279,7 +279,7 @@ static inline thread_ctx_t* create_thread_ctx(struct gengetopt_args_info* params
if (params->verbose_flag) if (params->verbose_flag)
syslog(LOG_DEBUG, "Create a new thread %p", thread_ctx); syslog(LOG_DEBUG, "Create a new thread %p", thread_ctx);
thread_ctx->sockets = malloc(sizeof(thread_ctx->sockets)*params->sockets_per_thread_arg); thread_ctx->sockets = malloc(sizeof(*thread_ctx->sockets)*params->sockets_per_thread_arg);
thread_ctx->nb_cur_sockets = 0; thread_ctx->nb_cur_sockets = 0;
thread_ctx->nb_available_sockets = params->sockets_per_thread_arg; thread_ctx->nb_available_sockets = params->sockets_per_thread_arg;
thread_ctx->max_timeout = params->sockets_timeout_arg; thread_ctx->max_timeout = params->sockets_timeout_arg;