From e2fdff6ec8caaf7f2ab38d837f605b9724bc5279 Mon Sep 17 00:00:00 2001 From: miod <> Date: Sun, 19 Jul 2015 05:42:55 +0000 Subject: Now that it is safe to invoke X509_STORE_CTX_cleanup() if X509_STORE_CTX_init() fails, check its return value and correctly mop up after ourselves. ok beck@ doug@ --- src/lib/libcrypto/x509/x509_vfy.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/lib/libcrypto/x509') diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index bc5905784d..f2dc356dc8 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_vfy.c,v 1.43 2015/07/19 01:44:16 doug Exp $ */ +/* $OpenBSD: x509_vfy.c,v 1.44 2015/07/19 05:42:55 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1091,8 +1091,10 @@ check_crl_path(X509_STORE_CTX *ctx, X509 *x) /* Don't allow recursive CRL path validation */ if (ctx->parent) return 0; - if (!X509_STORE_CTX_init(&crl_ctx, ctx->ctx, x, ctx->untrusted)) - return -1; + if (!X509_STORE_CTX_init(&crl_ctx, ctx->ctx, x, ctx->untrusted)) { + ret = -1; + goto err; + } crl_ctx.crls = ctx->crls; /* Copy verify params across */ -- cgit v1.2.3-55-g6feb