changeset 21459:862c159e58ab

11204 smatch issue in zlib/deflate.c Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Gergő Doma <domag02@gmail.com> Approved by: Dan McDonald <danmcd@joyent.com>
author Mark Adler <madler@alumni.caltech.edu>
date Thu, 06 Jun 2019 04:24:20 -0700
parents f42c9df8d6c0
children 3aa028bd5c93
files usr/src/contrib/zlib/deflate.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/contrib/zlib/deflate.c	Wed Sep 13 15:18:23 2017 -0400
+++ b/usr/src/contrib/zlib/deflate.c	Thu Jun 06 04:24:20 2019 -0700
@@ -188,8 +188,11 @@
  * prev[] will be initialized on the fly.
  */
 #define CLEAR_HASH(s) \
-    s->head[s->hash_size-1] = NIL; \
-    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+    do { \
+        s->head[s->hash_size-1] = NIL; \
+        zmemzero((Bytef *)s->head, \
+        (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
+    } while (0)
 
 /* ===========================================================================
  * Slide the hash table when sliding the window down (could be avoided with 32