summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2024-07-15 20:40:42 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2024-07-22 06:40:00 +0200
commitbe40a33419c88b1b1e2424914edf2d1e0b675ed0 (patch)
tree77c91aecb364e0142b2d24d64f0b6b691eaa7f17 /agent
parentdotlock: Avoid leaking directory handle. (diff)
downloadgnupg2-be40a33419c88b1b1e2424914edf2d1e0b675ed0.tar.xz
gnupg2-be40a33419c88b1b1e2424914edf2d1e0b675ed0.zip
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 <jjelen@redhat.com>
Diffstat (limited to 'agent')
-rw-r--r--agent/divert-tpm2.c1
1 files changed, 1 insertions, 0 deletions
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;
}