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

channels: Use calloc() in ssh_channel_new()

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Andreas Schneider
2018-09-03 17:55:41 +02:00
parent 9ac6ac6c26
commit ca464ca2ba

View File

@@ -84,12 +84,11 @@ ssh_channel ssh_channel_new(ssh_session session)
return NULL; return NULL;
} }
channel = malloc(sizeof(struct ssh_channel_struct)); channel = calloc(1, sizeof(struct ssh_channel_struct));
if (channel == NULL) { if (channel == NULL) {
ssh_set_error_oom(session); ssh_set_error_oom(session);
return NULL; return NULL;
} }
memset(channel,0,sizeof(struct ssh_channel_struct));
channel->stdout_buffer = ssh_buffer_new(); channel->stdout_buffer = ssh_buffer_new();
if (channel->stdout_buffer == NULL) { if (channel->stdout_buffer == NULL) {