From: Colin Leroy Date: Mon, 18 Sep 2017 08:03:39 +0000 (+0200) Subject: Fix double-free of keys X-Git-Tag: 3.16.0~66 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=cc91e29fb4d18737d648ae2112063440e1cdcc0f Fix double-free of keys --- diff --git a/src/plugins/pgpcore/select-keys.c b/src/plugins/pgpcore/select-keys.c index 47e4b66fd..92c228bd7 100644 --- a/src/plugins/pgpcore/select-keys.c +++ b/src/plugins/pgpcore/select-keys.c @@ -167,6 +167,9 @@ static void destroy_key (gpointer data) { gpgme_key_t key = data; + + debug_print("unref key %p\n", key); + gpgme_key_unref (key); } @@ -255,6 +258,7 @@ set_row (GtkCMCList *clist, gpgme_key_t key, gpgme_protocol_t proto) row = gtk_cmclist_append (clist, (gchar**)text); g_free (algo_buf); + gpgme_key_ref(key); gtk_cmclist_set_row_data_full (clist, row, key, destroy_key); } @@ -349,7 +353,9 @@ fill_clist (struct select_keys_s *sk, const char *pattern, gpgme_protocol_t prot if (exact_match && num_results == 1) return last_key; - gpgme_key_unref(last_key); + if (last_key != NULL) + gpgme_key_unref(last_key); + return NULL; }