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

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