diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.c | 6 |
1 files 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); |