Blame SOURCES/Avoid-uninitialized-free-when-allocating-buffers.patch

4bd34d
From 160f7a7c66e7e3d249de853cd5a1ebe0becd9fe1 Mon Sep 17 00:00:00 2001
4bd34d
From: Robbie Harwood <rharwood@redhat.com>
4bd34d
Date: Wed, 1 May 2019 11:27:13 -0400
4bd34d
Subject: [PATCH] Avoid uninitialized free when allocating buffers
4bd34d
4bd34d
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
4bd34d
Reviewed-by: Simo Sorce <simo@redhat.com>
4bd34d
Resolves: #248
4bd34d
(cherry picked from commit eafa3c9272c95646400123f8e4d6fb50cf36d36c)
4bd34d
---
4bd34d
 src/gp_export.c | 3 ++-
4bd34d
 1 file changed, 2 insertions(+), 1 deletion(-)
4bd34d
4bd34d
diff --git a/src/gp_export.c b/src/gp_export.c
4bd34d
index dbfddeb..a5681c0 100644
4bd34d
--- a/src/gp_export.c
4bd34d
+++ b/src/gp_export.c
4bd34d
@@ -300,6 +300,7 @@ static int gp_encrypt_buffer(krb5_context context, krb5_keyblock *key,
4bd34d
                          &data_in,
4bd34d
                          &enc_handle);
4bd34d
     if (ret) {
4bd34d
+        free(enc_handle.ciphertext.data);
4bd34d
         ret = EINVAL;
4bd34d
         goto done;
4bd34d
     }
4bd34d
@@ -308,12 +309,12 @@ static int gp_encrypt_buffer(krb5_context context, krb5_keyblock *key,
4bd34d
                                enc_handle.ciphertext.data,
4bd34d
                                out);
4bd34d
     if (ret) {
4bd34d
+        free(enc_handle.ciphertext.data);
4bd34d
         goto done;
4bd34d
     }
4bd34d
 
4bd34d
 done:
4bd34d
     free(padded);
4bd34d
-    free(enc_handle.ciphertext.data);
4bd34d
     return ret;
4bd34d
 }
4bd34d