diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2024-11-11 01:51:54 +0100 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2024-11-11 01:51:54 +0100 |
commit | b1f2695d24a8ab341d71b8cf65351b7ceed16e1b (patch) | |
tree | cc7398682e3c88651fba3bddf3a4c646043eb2bd /scd/app-nks.c | |
parent | gpg: Improve wording for only-pubkeys. (diff) | |
download | gnupg2-b1f2695d24a8ab341d71b8cf65351b7ceed16e1b.tar.xz gnupg2-b1f2695d24a8ab341d71b8cf65351b7ceed16e1b.zip |
scd: Fix resource leaks on error paths.
* scd/app-dinsig.c (do_readcert): Don't return directly but care about
releasing memory.
* scd/app-nks.c (readcert_from_ef): Likewise.
--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to '')
-rw-r--r-- | scd/app-nks.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/scd/app-nks.c b/scd/app-nks.c index 7c0eedfd0..89c33c698 100644 --- a/scd/app-nks.c +++ b/scd/app-nks.c @@ -999,7 +999,10 @@ readcert_from_ef (app_t app, int fid, unsigned char **cert, size_t *certlen) else if ( class == CLASS_UNIVERSAL && tag == TAG_SET && constructed ) rootca = 1; else - return gpg_error (GPG_ERR_INV_OBJ); + { + err = gpg_error (GPG_ERR_INV_OBJ); + goto leave; + } totobjlen = objlen + hdrlen; log_assert (totobjlen <= buflen); @@ -1030,7 +1033,10 @@ readcert_from_ef (app_t app, int fid, unsigned char **cert, size_t *certlen) if (err) goto leave; if ( !(class == CLASS_UNIVERSAL && tag == TAG_SEQUENCE && constructed) ) - return gpg_error (GPG_ERR_INV_OBJ); + { + err = gpg_error (GPG_ERR_INV_OBJ); + goto leave; + } totobjlen = objlen + hdrlen; log_assert (save_p + totobjlen <= buffer + buflen); memmove (buffer, save_p, totobjlen); @@ -1144,7 +1150,7 @@ iterate_over_filelist (app_t app, const char *want_keygripstr, int capability, continue; } - /* Found. Return but save the last idenx of the loop. */ + /* Found. Return but save the last index of the loop. */ *idx_p = idx; return 0; } |