summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorPavel Kopyl <p.kopyl@samsung.com>2017-11-03 18:18:59 +0300
committerRichard Levitte <levitte@openssl.org>2018-05-13 00:40:54 +0200
commit66e4a8944b894b9301226bad193a7d8ec330742d (patch)
tree0fdb9be941ae691568f3948afc7c59aa6b188354 /apps
parentf54b665e29a0ed8df2ea322a1f9e1b8057f13894 (diff)
Fix memory leaks in CA related functions.
(cherry picked from commit aebd0e5ca12d1ba0b229a4121a54afa5ea2d8aa1) Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6238)
Diffstat (limited to 'apps')
-rw-r--r--apps/ca.c5
-rw-r--r--apps/verify.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/apps/ca.c b/apps/ca.c
index 4f9de54921..31e87738d5 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1176,10 +1176,13 @@ int MAIN(int argc, char **argv)
if (j > 0) {
total_done++;
BIO_printf(bio_err, "\n");
- if (!BN_add_word(serial, 1))
+ if (!BN_add_word(serial, 1)) {
+ X509_free(x);
goto err;
+ }
if (!sk_X509_push(cert_sk, x)) {
BIO_printf(bio_err, "Memory allocation failure\n");
+ X509_free(x);
goto err;
}
}
diff --git a/apps/verify.c b/apps/verify.c
index c4bd197576..180ccf495c 100644
--- a/apps/verify.c
+++ b/apps/verify.c
@@ -277,6 +277,7 @@ static int check(X509_STORE *ctx, char *file,
X509_STORE_set_flags(ctx, vflags);
if (!X509_STORE_CTX_init(csc, ctx, x, uchain)) {
ERR_print_errors(bio_err);
+ X509_STORE_CTX_free(csc);
goto end;
}
if (tchain)