mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-05-14 20:15:08 +03:00
gzip: Use calloc in initcompress() and initdecompress()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
parent
f1608778be
commit
07986731c6
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user