4e3973
From 1e56dd1e7285d3026092ba794078edb290b4c1b1 Mon Sep 17 00:00:00 2001
4e3973
From: Ondrej Dubaj <odubaj@redhat.com>
4e3973
Date: Mon, 15 Mar 2021 13:06:35 +0100
4e3973
Subject: [PATCH] fixed isues found by covscan
4e3973
4e3973
---
4e3973
 contrib/minizip/mztools.c | 8 ++++++++
4e3973
 contrib/minizip/zip.c     | 4 ++--
4e3973
 deflate.c                 | 5 +++--
4e3973
 3 files changed, 13 insertions(+), 4 deletions(-)
4e3973
4e3973
diff --git a/contrib/minizip/mztools.c b/contrib/minizip/mztools.c
4e3973
index 96891c2..1197928 100644
4e3973
--- a/contrib/minizip/mztools.c
4e3973
+++ b/contrib/minizip/mztools.c
4e3973
@@ -286,6 +286,14 @@ uLong* bytesRecovered;
4e3973
     }
4e3973
   } else {
4e3973
     err = Z_STREAM_ERROR;
4e3973
+    if(fpZip != NULL)
4e3973
+      fclose(fpZip);
4e3973
+
4e3973
+    if(fpOut != NULL)
4e3973
+      fclose(fpOut);
4e3973
+
4e3973
+    if(fpOutCD != NULL)
4e3973
+      fclose(fpOutCD);
4e3973
   }
4e3973
   return err;
4e3973
 }
4e3973
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
4e3973
index 44e88a9..a753c17 100644
4e3973
--- a/contrib/minizip/zip.c
4e3973
+++ b/contrib/minizip/zip.c
4e3973
@@ -526,8 +526,8 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
4e3973
         break;
4e3973
       }
4e3973
 
4e3973
-      if (uPosFound!=0)
4e3973
-        break;
4e3973
+    if (uPosFound!=0)
4e3973
+      break;
4e3973
   }
4e3973
   TRYFREE(buf);
4e3973
   return uPosFound;
4e3973
diff --git a/deflate.c b/deflate.c
4e3973
index 085abbe..3963e79 100644
4e3973
--- a/deflate.c
4e3973
+++ b/deflate.c
4e3973
@@ -203,9 +203,10 @@ local const config configuration_table[10] = {
4e3973
  * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
4e3973
  * prev[] will be initialized on the fly.
4e3973
  */
4e3973
-#define CLEAR_HASH(s) \
4e3973
+#define CLEAR_HASH(s) do { \
4e3973
     s->head[s->hash_size-1] = NIL; \
4e3973
-    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
4e3973
+    zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); \
4e3973
+} while (0)
4e3973
 
4e3973
 /* ===========================================================================
4e3973
  * Slide the hash table when sliding the window down (could be avoided with 32
4e3973
-- 
4e3973
2.26.0
4e3973