commit cc91e29fb4d18737d648ae2112063440e1cdcc0f
parent 9b17603ded77a56d10e56e80b9647487e25546da
Author: Colin Leroy <colin@colino.net>
Date: Mon, 18 Sep 2017 10:03:39 +0200
Fix double-free of keys
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git 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;
}