]> granicus.if.org Git - openssl/commitdiff
Fix a memory leak in the ca application
authorMatt Caswell <matt@openssl.org>
Wed, 14 Mar 2018 14:40:18 +0000 (14:40 +0000)
committerMatt Caswell <matt@openssl.org>
Thu, 15 Mar 2018 13:34:57 +0000 (13:34 +0000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5445)

apps/ca.c

index 2490710a5674d9714922a01bd60f8b086b1451f9..4f9de5492148a180333f81ade80d36e8498ac3c0 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -2155,11 +2155,11 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
     irow = NULL;
     ok = 1;
  err:
-    if (irow != NULL) {
+    if (ok != 1) {
         for (i = 0; i < DB_NUMBER; i++)
             OPENSSL_free(row[i]);
-        OPENSSL_free(irow);
     }
+    OPENSSL_free(irow);
 
     if (CAname != NULL)
         X509_NAME_free(CAname);