[binutils-gdb] gas/compress-debug.c init all of strm

Alan Modra amodra@sourceware.org
Tue Mar 14 02:06:06 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4c6f9528b6db9838e8ed2050744a08b53265acb2

commit 4c6f9528b6db9838e8ed2050744a08b53265acb2
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Mar 10 20:25:29 2023 +1030

    gas/compress-debug.c init all of strm
    
            * compress-debug.c (compress_init): Clear all of strm.

Diff:
---
 gas/compress-debug.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gas/compress-debug.c b/gas/compress-debug.c
index 7c979132ae1..174c70e65d5 100644
--- a/gas/compress-debug.c
+++ b/gas/compress-debug.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 #include <stdio.h>
+#include <string.h>
 #include <zlib.h>
 #if HAVE_ZSTD
 #include <zstd.h>
@@ -39,10 +40,7 @@ compress_init (bool use_zstd)
   }
 
   static struct z_stream_s strm;
-
-  strm.zalloc = NULL;
-  strm.zfree = NULL;
-  strm.opaque = NULL;
+  memset (&strm, 0, sizeof (strm));
   deflateInit (&strm, Z_DEFAULT_COMPRESSION);
   return &strm;
 }


More information about the Binutils-cvs mailing list