diff options
author | Jakub Jelen <jjelen@redhat.com> | 2021-04-07 17:58:10 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-11-12 07:35:56 +0100 |
commit | 50f32eb0664d921242563f6602ce5a8f46557085 (patch) | |
tree | a9bd72e4835cefcde5bcd60e2225e20929706dc3 /agent/protect.c | |
parent | scd: Avoid memory leak. (diff) | |
download | gnupg2-50f32eb0664d921242563f6602ce5a8f46557085.tar.xz gnupg2-50f32eb0664d921242563f6602ce5a8f46557085.zip |
agent: Correctly free memory on error path.
* agent/protect.c (merge_lists): Free memory on error.
--
GnuPG-bug-id: 5393
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'agent/protect.c')
-rw-r--r-- | agent/protect.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/agent/protect.c b/agent/protect.c index 4ceb3006e..30ee1345d 100644 --- a/agent/protect.c +++ b/agent/protect.c @@ -970,7 +970,10 @@ merge_lists (const unsigned char *protectedkey, /* Copy the cleartext. */ s = cleartext; if (*s != '(' && s[1] != '(') - return gpg_error (GPG_ERR_BUG); /*we already checked this */ + { + xfree (newlist); + return gpg_error (GPG_ERR_BUG); /*we already checked this */ + } s += 2; startpos = s; while ( *s == '(' ) |