From be40a33419c88b1b1e2424914edf2d1e0b675ed0 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 15 Jul 2024 20:40:42 +0200 Subject: [PATCH] agent: Avoid memory leak when handling tpm2. * agent/divert-tpm2.c (agent_write_tpm2_shadow_key): Free memory on errors. -- GnuPG-bug-id: 7201 Signed-off-by: Jakub Jelen --- agent/divert-tpm2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/agent/divert-tpm2.c b/agent/divert-tpm2.c index 6ebb9ef78..5779ee974 100644 --- a/agent/divert-tpm2.c +++ b/agent/divert-tpm2.c @@ -53,6 +53,7 @@ agent_write_tpm2_shadow_key (ctrl_t ctrl, const unsigned char *grip, if (err) { log_error ("failed to delete unshadowed key: %s\n", gpg_strerror (err)); + xfree (shdkey); return err; }