From ae6dba76668bd8245e9073ca37f7742b08f93f0c Mon Sep 17 00:00:00 2001 From: jsing Date: Thu, 22 Jun 2017 17:34:25 +0000 Subject: [PATCH] Use the standard `rv' idiom in tls_keypair_load_cert(), rather than duplicating clean up code. --- lib/libtls/tls_server.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/libtls/tls_server.c b/lib/libtls/tls_server.c index abac01ca5cf..ea8f0ce7286 100644 --- a/lib/libtls/tls_server.c +++ b/lib/libtls/tls_server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_server.c,v 1.37 2017/05/06 20:59:28 jsing Exp $ */ +/* $OpenBSD: tls_server.c,v 1.38 2017/06/22 17:34:25 jsing Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -201,6 +201,7 @@ tls_keypair_load_cert(struct tls_keypair *keypair, struct tls_error *error, char *errstr = "unknown"; BIO *cert_bio = NULL; int ssl_err; + int rv = -1; X509_free(*cert); *cert = NULL; @@ -221,14 +222,12 @@ tls_keypair_load_cert(struct tls_keypair *keypair, struct tls_error *error, goto err; } - BIO_free(cert_bio); - - return (0); + rv = 0; err: BIO_free(cert_bio); - return (-1); + return (rv); } static int -- 2.20.1