diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2018-01-18 18:50:11 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-01-18 18:52:04 +0100 |
commit | aaeb938ca4c86e87f85346701c0c6972d3a7620f (patch) | |
tree | 541620925d48ca0bbb855bf124fa384f38a92460 | |
parent | ef4a81ea0c5e0166b3df1f9bf3d186379e24d13a (diff) | |
download | libssh-aaeb938ca4c86e87f85346701c0c6972d3a7620f.tar.gz libssh-aaeb938ca4c86e87f85346701c0c6972d3a7620f.tar.xz libssh-aaeb938ca4c86e87f85346701c0c6972d3a7620f.zip |
channels: Use calloc() instead of malloc()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-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); |