1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-29 01:03:57 +03:00

channels: Use calloc() instead of malloc()

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2018-01-18 18:50:11 +01:00
parent ef4a81ea0c
commit aaeb938ca4

View File

@@ -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);