Fix memory leak in crl2pkcs7 app
authorMatt Caswell <matt@openssl.org>
Wed, 27 Apr 2016 13:59:35 +0000 (14:59 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 1 Jun 2016 17:00:53 +0000 (18:00 +0100)
The crl2pkcs7 app leaks a stack of OPENSSL_STRINGs in error paths.

Reviewed-by: Richard Levitte <levitte@openssl.org>
apps/crl2p7.c

index 73e62702ce7e8ed797900c8148ac53bfcac891bf..1631258793ec96ae5d653be3b6ebb7bfa7f3c26d 100644 (file)
@@ -143,8 +143,6 @@ int crl2pkcs7_main(int argc, char **argv)
             }
         }
 
-    sk_OPENSSL_STRING_free(certflst);
-
     out = bio_open_default(outfile, 'w', outformat);
     if (out == NULL)
         goto end;
@@ -160,6 +158,7 @@ int crl2pkcs7_main(int argc, char **argv)
     }
     ret = 0;
  end:
+    sk_OPENSSL_STRING_free(certflst);
     BIO_free(in);
     BIO_free_all(out);
     PKCS7_free(p7);