Blame SOURCES/Correct-error-handling-bug-in-prior-commit.patch

963210
From ca3e61600f1400974c63b2abb30b44f0c94d550b Mon Sep 17 00:00:00 2001
963210
From: Greg Hudson <ghudson@mit.edu>
963210
Date: Thu, 23 Mar 2017 13:42:55 -0400
963210
Subject: [PATCH] Correct error handling bug in prior commit
963210
963210
In crypto_encode_der_cert(), if the second i2d_X509() invocation
963210
fails, make sure to free the allocated pointer and not the
963210
possibly-modified alias.
963210
963210
ticket: 8561
963210
(cherry picked from commit 7fdaef7c3280c86b5df25ae061fb04cc56d8620c)
963210
---
963210
 src/plugins/preauth/pkinit/pkinit_crypto_openssl.c | 4 ++--
963210
 1 file changed, 2 insertions(+), 2 deletions(-)
963210
963210
diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
963210
index a5b010b26..90c30dbf5 100644
963210
--- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
963210
+++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
963210
@@ -6196,10 +6196,10 @@ crypto_encode_der_cert(krb5_context context, pkinit_req_crypto_context reqctx,
963210
     if (len <= 0)
963210
         return EINVAL;
963210
     p = der = malloc(len);
963210
-    if (p == NULL)
963210
+    if (der == NULL)
963210
         return ENOMEM;
963210
     if (i2d_X509(reqctx->received_cert, &p) <= 0) {
963210
-        free(p);
963210
+        free(der);
963210
         return EINVAL;
963210
     }
963210
     *der_out = der;