summaryrefslogtreecommitdiff
path: root/apps/ca.c
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-02 08:35:32 +0200
commitaebd0e5ca12d1ba0b229a4121a54afa5ea2d8aa1 (patch)
treeb9fca98d10a2a71395910ef190652f41e16701aa /apps/ca.c
parentc4fa1f7fc016919a5b3d4ea2aa66c77e0cc40c9d (diff)
downloadopenssl-new-aebd0e5ca12d1ba0b229a4121a54afa5ea2d8aa1.tar.gz
Fix memory leaks in CA related functions.
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4700)
Diffstat (limited to 'apps/ca.c')
-rw-r--r--apps/ca.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/ca.c b/apps/ca.c
index ea774ad557..afc5e349b4 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -934,10 +934,13 @@ end_of_options:
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 end;
+ }
if (!sk_X509_push(cert_sk, x)) {
BIO_printf(bio_err, "Memory allocation failure\n");
+ X509_free(x);
goto end;
}
}