Blame SOURCES/Fix-a-memory-leak-on-invalid-input.patch

83f6ba
From 47af5b2365a306532d1e0b786f0d7f9754f914cd Mon Sep 17 00:00:00 2001
83f6ba
From: Peter Pentchev <roam@debian.org>
83f6ba
Date: Mon, 1 Jun 2020 10:25:34 +0300
83f6ba
Subject: [PATCH] Fix a memory leak on invalid input.
83f6ba
83f6ba
---
83f6ba
 src/drpm_decompstrm.c | 6 +++---
83f6ba
 1 file changed, 3 insertions(+), 3 deletions(-)
83f6ba
83f6ba
diff --git a/src/drpm_decompstrm.c b/src/drpm_decompstrm.c
83f6ba
index d885dcf..ec3115e 100644
83f6ba
--- a/src/drpm_decompstrm.c
83f6ba
+++ b/src/drpm_decompstrm.c
83f6ba
@@ -746,14 +746,14 @@ int readchunk_zstd(struct decompstrm *strm)
83f6ba
             return DRPM_ERR_IO;
83f6ba
     }
83f6ba
 
83f6ba
+    if (in_len == 0)
83f6ba
+        return DRPM_ERR_FORMAT;
83f6ba
+
83f6ba
     size_t const buffOutSize = ZSTD_DStreamOutSize();
83f6ba
     void* const buffOut = malloc(buffOutSize);
83f6ba
     if (buffOut == NULL)
83f6ba
         return DRPM_ERR_MEMORY;
83f6ba
 
83f6ba
-    if (in_len == 0)
83f6ba
-        return DRPM_ERR_FORMAT;
83f6ba
-
83f6ba
     ZSTD_inBuffer input = { in_buffer, in_len, 0 };
83f6ba
 
83f6ba
     while (input.pos < input.size) {