summaryrefslogtreecommitdiff
path: root/apps/ocsp.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-10-18 00:04:10 +0100
committerDr. Stephen Henson <steve@openssl.org>2015-10-18 14:36:21 +0100
commitbb7fc98c43e29b9169522f6e25aa5988ce931c6c (patch)
treed237defe7a3ffd3a86266178382c2d1652f6fe76 /apps/ocsp.c
parent7f3e6f8c243710b8dc89f385196987ad83c7848d (diff)
downloadopenssl-new-bb7fc98c43e29b9169522f6e25aa5988ce931c6c.tar.gz
Fix memory leak with -issuer option.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/ocsp.c')
-rw-r--r--apps/ocsp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/ocsp.c b/apps/ocsp.c
index 0f8ddcc33f..982eddf20c 100644
--- a/apps/ocsp.c
+++ b/apps/ocsp.c
@@ -404,13 +404,14 @@ int ocsp_main(int argc, char **argv)
path = opt_arg();
break;
case OPT_ISSUER:
- X509_free(issuer);
issuer = load_cert(opt_arg(), FORMAT_PEM,
NULL, NULL, "issuer certificate");
if (issuer == NULL)
goto end;
- if ((issuers = sk_X509_new_null()) == NULL)
- goto end;
+ if (issuers == NULL) {
+ if ((issuers = sk_X509_new_null()) == NULL)
+ goto end;
+ }
sk_X509_push(issuers, issuer);
break;
case OPT_CERT:
@@ -750,6 +751,7 @@ int ocsp_main(int argc, char **argv)
EVP_PKEY_free(key);
EVP_PKEY_free(rkey);
X509_free(cert);
+ sk_X509_pop_free(issuers, X509_free);
X509_free(rsigner);
X509_free(rca_cert);
free_index(rdb);