mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
fixed memory leaks and almost all undefined behaviour
This commit is contained in:
parent
592de19843
commit
1d5e9705db
10 changed files with 19 additions and 10 deletions
|
|
@ -234,7 +234,7 @@ int gzwrite _Z_OF((gzFile, const void *, unsigned));
|
|||
|
||||
int gzwrite(gzFile gz, const void *buf, unsigned len) {
|
||||
z_stream *strm;
|
||||
unsigned char out[BUFLEN];
|
||||
unsigned char out[BUFLEN] = 0;
|
||||
|
||||
if (gz == NULL || !gz->write)
|
||||
return 0;
|
||||
|
|
@ -287,7 +287,7 @@ int gzclose _Z_OF((gzFile));
|
|||
|
||||
int gzclose(gzFile gz) {
|
||||
z_stream *strm;
|
||||
unsigned char out[BUFLEN];
|
||||
unsigned char out[BUFLEN] = 0;
|
||||
|
||||
if (gz == NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ local int gz_init(gz_statep state) {
|
|||
strm->next_out = state.state->out;
|
||||
state.state->x.next = strm->next_out;
|
||||
}
|
||||
|
||||
free(state.state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue