diff options
author | Matt Caswell <matt@openssl.org> | 2016-04-26 18:45:46 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-06-01 14:58:46 +0100 |
commit | f83b85fb0f46f7a3e92651f1e5eb7b1081fb8650 (patch) | |
tree | 9db28ab5a0c9c01e56beb107ee0b46e15360fe1f /apps | |
parent | 7b0ee1353d0e3ece7986e12c6684f1aac7483cea (diff) |
Ensure an ASN1_OBJECT is freed in error paths
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/x509.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/x509.c b/apps/x509.c index 56c6fcca6a..64197665d0 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -145,7 +145,7 @@ OPTIONS x509_options[] = { int x509_main(int argc, char **argv) { ASN1_INTEGER *sno = NULL; - ASN1_OBJECT *objtmp; + ASN1_OBJECT *objtmp = NULL; BIO *out = NULL; CONF *extconf = NULL; EVP_PKEY *Upkey = NULL, *CApkey = NULL, *fkey = NULL; @@ -277,6 +277,7 @@ int x509_main(int argc, char **argv) if (trust == NULL && (trust = sk_ASN1_OBJECT_new_null()) == NULL) goto end; sk_ASN1_OBJECT_push(trust, objtmp); + objtmp = NULL; trustout = 1; break; case OPT_ADDREJECT: @@ -290,6 +291,7 @@ int x509_main(int argc, char **argv) && (reject = sk_ASN1_OBJECT_new_null()) == NULL) goto end; sk_ASN1_OBJECT_push(reject, objtmp); + objtmp = NULL; trustout = 1; break; case OPT_SETALIAS: @@ -590,6 +592,7 @@ int x509_main(int argc, char **argv) objtmp = sk_ASN1_OBJECT_value(trust, i); X509_add1_trust_object(x, objtmp); } + objtmp = NULL; } if (reject) { @@ -597,6 +600,7 @@ int x509_main(int argc, char **argv) objtmp = sk_ASN1_OBJECT_value(reject, i); X509_add1_reject_object(x, objtmp); } + objtmp = NULL; } if (num) { @@ -885,6 +889,7 @@ int x509_main(int argc, char **argv) ASN1_INTEGER_free(sno); sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free); sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free); + ASN1_OBJECT_free(objtmp); OPENSSL_free(passin); return (ret); } |