linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bruno Meneguele <bmeneg@redhat.com>
To: linux-integrity@vger.kernel.org
Cc: Mimi Zohar <zohar@linux.ibm.com>, Petr Vorel <pvorel@suse.cz>,
	Vitaly Chikunov <vt@altlinux.org>,
	Bruno Meneguele <bmeneg@redhat.com>
Subject: [PATCH 2/3] ima-evm-utils: fix memory leak in case of error
Date: Wed, 15 Jul 2020 18:39:05 -0300	[thread overview]
Message-ID: <20200715213906.194041-3-bmeneg@redhat.com> (raw)
In-Reply-To: <20200715213906.194041-1-bmeneg@redhat.com>

OpenSSL context should be freed in case of versions >= 1.1 before leaving
the function in case EVP_DigestUpdate() returns any error.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
---
 src/evmctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/evmctl.c b/src/evmctl.c
index d974ba6..2f5bd52 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -2143,7 +2143,7 @@ static void calc_bootaggr(struct tpm_bank_info *bank)
 		err = EVP_DigestUpdate(pctx, bank->pcr[i], bank->digest_size);
 		if (!err) {
 			log_err("EVP_DigestUpdate() failed\n");
-			return;
+			goto out;
 		}
 	}
 
@@ -2152,7 +2152,7 @@ static void calc_bootaggr(struct tpm_bank_info *bank)
 			err = EVP_DigestUpdate(pctx, bank->pcr[i], bank->digest_size);
 			if (!err) {
 				log_err("EVP_DigestUpdate() failed\n");
-				return;
+				goto out;
 			}
 		}
 	}
-- 
2.26.2


  parent reply	other threads:[~2020-07-15 21:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 21:39 [PATCH 0/3] ima-evm-utils: miscellanous bug fixes Bruno Meneguele
2020-07-15 21:39 ` [PATCH 1/3] ima-evm-utils: fix empty label at end of function Bruno Meneguele
2020-07-15 21:39 ` Bruno Meneguele [this message]
2020-07-15 21:39 ` [PATCH 3/3] ima-evm-utils: fix overflow on printing boot_aggregate Bruno Meneguele
2020-07-15 22:30   ` Mimi Zohar
2020-07-15 22:33     ` Bruno Meneguele
2020-07-15 22:30 ` [PATCH 0/3] ima-evm-utils: miscellanous bug fixes Mimi Zohar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200715213906.194041-3-bmeneg@redhat.com \
    --to=bmeneg@redhat.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=pvorel@suse.cz \
    --cc=vt@altlinux.org \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).