summaryrefslogtreecommitdiffstats
path: root/g10/revoke.c
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2021-05-20 10:13:51 +0200
committerWerner Koch <wk@gnupg.org>2021-05-20 13:38:39 +0200
commit2af7bb2295cda5377546cedd0c906a3cff4d2427 (patch)
tree3e912bccb258941b085959201b6c81b8940339a5 /g10/revoke.c
parentdirmgr: clean up memory on error code paths (diff)
downloadgnupg2-2af7bb2295cda5377546cedd0c906a3cff4d2427.tar.xz
gnupg2-2af7bb2295cda5377546cedd0c906a3cff4d2427.zip
g10: Fix memory leaks
* g10/card-util.c (change_pin): free answer on errors (ask_card_keyattr): free answer on error * g10/cpr.c (do_get_from_fd): free string * g10/gpg.c (check_permissions): free dir on weird error * g10/import.c (append_new_uid): release knode * g10/keyedit.c (menu_set_keyserver_url): free answer (menu_set_keyserver_url): free user * g10/keygen.c (print_status_key_not_created): move allocation after sanity check (ask_expire_interval): free answer (card_store_key_with_backup): goto leave instaed of return * g10/keyserver.c (parse_keyserver_uri): goto fail instead of return * g10/revoke.c (gen_desig_revoke): release kdbhd (gen_desig_revoke): free answer * g10/tofu.c (ask_about_binding): free sqerr and response * g10/trustdb.c (ask_ownertrust): free pk -- Signed-off-by: Jakub Jelen <jjelen@redhat.com> Further changes: * g10/card-util.c (change_pin): Do not set answer to NULL. * g10/keyedit.c(menu_set_keyserver_url): Use !func() pattern. Signed-off-by: Werner Koch <wk@gnupg.org> GnuPG-bug-id: 5393
Diffstat (limited to 'g10/revoke.c')
-rw-r--r--g10/revoke.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/g10/revoke.c b/g10/revoke.c
index c0a003b6f..d6cbf93cb 100644
--- a/g10/revoke.c
+++ b/g10/revoke.c
@@ -435,6 +435,7 @@ gen_desig_revoke (ctrl_t ctrl, const char *uname, strlist_t locusr)
iobuf_close(out);
release_revocation_reason_info( reason );
release_armor_context (afx);
+ keydb_release (kdbhd);
return rc;
}
@@ -804,7 +805,10 @@ ask_revocation_reason( int key_rev, int cert_rev, int hint )
trim_spaces( answer );
cpr_kill_prompt();
if( *answer == 'q' || *answer == 'Q')
- return NULL; /* cancel */
+ {
+ xfree (answer);
+ return NULL; /* cancel */
+ }
if( hint && !*answer )
n = hint;
else if(!digitp( answer ) )