Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/settings.c @ 2340:6eeef7be58f3
Do also free pgp/otr settings
author | franky |
---|---|
date | Sun, 19 May 2019 09:45:53 +0200 |
parents | 7f11a567d236 |
children | c78988260b9f |
comparison
equal
deleted
inserted
replaced
2339:7f11a567d236 | 2340:6eeef7be58f3 |
---|---|
46 typedef struct { | 46 typedef struct { |
47 gchar *pgp_keyid; /* KeyId the contact is supposed to use */ | 47 gchar *pgp_keyid; /* KeyId the contact is supposed to use */ |
48 guint pgp_disabled; /* If TRUE, PGP is disabled for outgoing messages */ | 48 guint pgp_disabled; /* If TRUE, PGP is disabled for outgoing messages */ |
49 guint pgp_force; /* If TRUE, PGP is used w/o negotiation */ | 49 guint pgp_force; /* If TRUE, PGP is used w/o negotiation */ |
50 } pgpopt_t; | 50 } pgpopt_t; |
51 | |
52 void pgpopt_free(gpointer data) | |
53 { | |
54 pgpopt_t *opt = (pgpopt_t *)data; | |
55 g_free(opt->pgp_keyid); | |
56 g_free(opt); | |
57 } | |
51 #endif | 58 #endif |
52 | 59 |
53 typedef struct { | 60 typedef struct { |
54 settings_guard_t guard; | 61 settings_guard_t guard; |
55 } installed_guard_t; | 62 } installed_guard_t; |
77 option = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free); | 84 option = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free); |
78 alias = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free); | 85 alias = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free); |
79 binding = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free); | 86 binding = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free); |
80 guards = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free); | 87 guards = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free); |
81 #ifdef HAVE_GPGME | 88 #ifdef HAVE_GPGME |
82 pgpopt = g_hash_table_new(&g_str_hash, &g_str_equal); | 89 pgpopt = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &pgpopt_free); |
83 #endif | 90 #endif |
84 #ifdef HAVE_LIBOTR | 91 #ifdef HAVE_LIBOTR |
85 otrpolicy = g_hash_table_new(&g_str_hash, &g_str_equal); | 92 otrpolicy = g_hash_table_new_full(&g_str_hash, &g_str_equal, &g_free, &g_free); |
86 #endif | 93 #endif |
87 } | 94 } |
88 | 95 |
89 void settings_free(void) | 96 void settings_free(void) |
90 { | 97 { |
650 | 657 |
651 #ifdef HAVE_LIBOTR | 658 #ifdef HAVE_LIBOTR |
652 static void remove_default_policies(char *k, char *policy, void *defaultp) | 659 static void remove_default_policies(char *k, char *policy, void *defaultp) |
653 { | 660 { |
654 if (*(enum otr_policy *)policy == *(enum otr_policy *)defaultp) { | 661 if (*(enum otr_policy *)policy == *(enum otr_policy *)defaultp) { |
655 g_free((enum otr_policy *) policy); | |
656 g_hash_table_remove(otrpolicy, k); | 662 g_hash_table_remove(otrpolicy, k); |
657 } | 663 } |
658 } | 664 } |
659 #endif | 665 #endif |
660 | 666 |
672 | 678 |
673 otrdata = g_hash_table_lookup(otrpolicy, bjid); | 679 otrdata = g_hash_table_lookup(otrpolicy, bjid); |
674 | 680 |
675 if (value == default_policy) { | 681 if (value == default_policy) { |
676 if (otrdata) { | 682 if (otrdata) { |
677 g_free(otrdata); | |
678 g_hash_table_remove(otrpolicy, bjid); | 683 g_hash_table_remove(otrpolicy, bjid); |
679 } | 684 } |
680 } else if (otrdata) { | 685 } else if (otrdata) { |
681 *otrdata = value; | 686 *otrdata = value; |
682 } else { | 687 } else { |