Implemented settings_free()
This removes many leaked memory messages from valgrind and thus makes
it easier to read its output.
--- a/mcabber/mcabber/main.c Sun May 12 13:17:36 2019 +0200
+++ b/mcabber/mcabber/main.c Sat May 18 20:44:01 2019 +0200
@@ -595,6 +595,7 @@
/* Save pending message state */
hlog_save_state();
caps_free();
+ settings_free();
printf("\n\nThanks for using mcabber!\n");
--- a/mcabber/mcabber/settings.c Sun May 12 13:17:36 2019 +0200
+++ b/mcabber/mcabber/settings.c Sat May 18 20:44:01 2019 +0200
@@ -86,6 +86,20 @@
#endif
}
+void settings_free(void)
+{
+ g_hash_table_destroy(option);
+ g_hash_table_destroy(alias);
+ g_hash_table_destroy(binding);
+ g_hash_table_destroy(guards);
+#ifdef HAVE_GPGME
+ g_hash_table_destroy(pgpopt);
+#endif
+#ifdef HAVE_LIBOTR
+ g_hash_table_destroy(otrpolicy);
+#endif
+}
+
// settings_get_mcabber_config_dir()
// Returns the mcabber configuration directory.
// The directory is looked up for only once (and the string is never freed,
--- a/mcabber/mcabber/settings.h Sun May 12 13:17:36 2019 +0200
+++ b/mcabber/mcabber/settings.h Sat May 18 20:44:01 2019 +0200
@@ -31,6 +31,7 @@
typedef gchar *(*settings_guard_t)(const gchar *key, const gchar *new_value);
void settings_init(void);
+void settings_free(void);
const gchar *settings_get_mcabber_config_dir(void);
int cfg_read_file(char *filename, guint mainfile);
guint parse_assigment(gchar *assignment, gchar **pkey, gchar **pval);