From aaeb938ca4c86e87f85346701c0c6972d3a7620f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 18 Jan 2018 18:50:11 +0100 Subject: channels: Use calloc() instead of malloc() Signed-off-by: Andreas Schneider --- src/channels.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/channels.c b/src/channels.c index b74c4f3d..6e65dc62 100644 --- a/src/channels.c +++ b/src/channels.c @@ -3105,18 +3105,18 @@ int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans, } /* Prepare the outgoing temporary arrays */ - rchans = malloc(sizeof(ssh_channel ) * (count_ptrs(readchans) + 1)); + rchans = calloc(count_ptrs(readchans) + 1, sizeof(ssh_channel)); if (rchans == NULL) { return SSH_ERROR; } - wchans = malloc(sizeof(ssh_channel ) * (count_ptrs(writechans) + 1)); + wchans = calloc(count_ptrs(writechans) + 1, sizeof(ssh_channel)); if (wchans == NULL) { SAFE_FREE(rchans); return SSH_ERROR; } - echans = malloc(sizeof(ssh_channel ) * (count_ptrs(exceptchans) + 1)); + echans = calloc(count_ptrs(exceptchans) + 1, sizeof(ssh_channel)); if (echans == NULL) { SAFE_FREE(rchans); SAFE_FREE(wchans); -- cgit v1.2.3