diff options
| author | Nathan Moinvaziri <nathan@nathanm.com> | 2020-06-28 14:45:22 -0700 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2020-06-29 11:46:22 +0200 |
| commit | 551254a4c175fbebfabffaa9a4684ab528f10c89 (patch) | |
| tree | 8943abcb238734c3a972dff1c42cef0c13793628 /test | |
| parent | c37d9f1d6d3af7619ac20e71784ea82aba7b586e (diff) | |
| download | Project-Tick-551254a4c175fbebfabffaa9a4684ab528f10c89.tar.gz Project-Tick-551254a4c175fbebfabffaa9a4684ab528f10c89.zip | |
Use calloc to allocate memory and set to zero for memory sanitizer.
Diffstat (limited to 'test')
| -rw-r--r-- | test/minigzip.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/test/minigzip.c b/test/minigzip.c index df260967eb..a09fcdcc24 100644 --- a/test/minigzip.c +++ b/test/minigzip.c @@ -90,7 +90,7 @@ void error(const char *msg) { */ void gz_compress(FILE *in, gzFile out) { - char *buf = (char *)malloc(BUFLEN); + char *buf = (char *)calloc(BUFLEN, 1); int len; int err; @@ -100,9 +100,6 @@ void gz_compress(FILE *in, gzFile out) { */ if (gz_compress_mmap(in, out) == Z_OK) return; #endif - /* Clear out the contents of buf before reading from the file to avoid - MemorySanitizer: use-of-uninitialized-value warnings. */ - memset(buf, 0, BUFLEN); for (;;) { len = (int)fread(buf, 1, BUFLEN, in); if (ferror(in)) { |
