From 07986731c6e94cda22429e5a3397d6f414e2078a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 3 Sep 2018 18:00:12 +0200 Subject: [PATCH] gzip: Use calloc in initcompress() and initdecompress() Signed-off-by: Andreas Schneider Reviewed-by: Jakub Jelen --- src/gzip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gzip.c b/src/gzip.c index 349d53fb..23c9d0de 100644 --- a/src/gzip.c +++ b/src/gzip.c @@ -39,11 +39,10 @@ static z_stream *initcompress(ssh_session session, int level) { z_stream *stream = NULL; int status; - stream = malloc(sizeof(z_stream)); + stream = calloc(1, sizeof(z_stream)); if (stream == NULL) { return NULL; } - memset(stream, 0, sizeof(z_stream)); status = deflateInit(stream, level); if (status != Z_OK) { @@ -128,11 +127,10 @@ static z_stream *initdecompress(ssh_session session) { z_stream *stream = NULL; int status; - stream = malloc(sizeof(z_stream)); + stream = calloc(1, sizeof(z_stream)); if (stream == NULL) { return NULL; } - memset(stream,0,sizeof(z_stream)); status = inflateInit(stream); if (status != Z_OK) {