public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: linux-integrity@vger.kernel.org
Cc: zohar@linux.ibm.com, roberto.sassu@huawei.com,
	Stefan Berger <stefanb@linux.ibm.com>
Subject: [ima-evm-utils: PATCH 1/2] Use EVP_PKEY_free to free a key of public_key_entry
Date: Tue, 24 Mar 2026 17:23:41 -0400	[thread overview]
Message-ID: <20260324212342.739685-2-stefanb@linux.ibm.com> (raw)
In-Reply-To: <20260324212342.739685-1-stefanb@linux.ibm.com>

Use EVP_PKEY_free to fix a memory leak that occurs when using free() on the
key field of public_key_entry that is a pointer to an EVP_PKEY.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 src/libimaevm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libimaevm.c b/src/libimaevm.c
index 3b268d5..6512ee5 100644
--- a/src/libimaevm.c
+++ b/src/libimaevm.c
@@ -400,7 +400,7 @@ void imaevm_free_public_keys(struct public_key_entry *public_keys)
 	while (entry) {
 		next = entry->next;
 		if (entry->key)
-			free(entry->key);
+			EVP_PKEY_free(entry->key);
 		free(entry);
 		entry = next;
 	}
-- 
2.53.0


  reply	other threads:[~2026-03-24 21:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 21:23 [ima-evm-utils: PATCH 0/2] Fix memory leaks in libimaevm Stefan Berger
2026-03-24 21:23 ` Stefan Berger [this message]
2026-03-24 21:23 ` [ima-evm-utils: PATCH 2/2] Avoid memory leak if public_keys is NULL Stefan Berger

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=20260324212342.739685-2-stefanb@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=roberto.sassu@huawei.com \
    --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