Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Panozzo <giovanni@panozzo.it>2018-02-12 02:32:34 +0300
committerGiovanni Panozzo <giovanni@panozzo.it>2018-02-12 02:32:34 +0300
commit89a997f7f7d7dfc65d9962cbe6e4d9b2c16a2025 (patch)
treee00736cffc97998ee49f0c076f71380b4f7a57af
parent9088bc90536e897cc0c447191623dd1662fb46fc (diff)
Fix memory leaks
-rw-r--r--remmina/src/remmina_stats.c16
-rw-r--r--remmina/src/remmina_stats_sender.c3
2 files changed, 16 insertions, 3 deletions
diff --git a/remmina/src/remmina_stats.c b/remmina/src/remmina_stats.c
index 4a169311c..fb24670a0 100644
--- a/remmina/src/remmina_stats.c
+++ b/remmina/src/remmina_stats.c
@@ -506,7 +506,7 @@ static void remmina_profiles_get_data(RemminaFile *remminafile, gpointer user_da
if (pdata->pdatestr) {
g_hash_table_insert(pdata->proto_date, g_strdup(pdata->protocol), g_strdup(pdata->pdatestr));
}else {
- g_hash_table_insert(pdata->proto_date, g_strdup(pdata->protocol), THEDAY);
+ g_hash_table_insert(pdata->proto_date, g_strdup(pdata->protocol), g_strdup(THEDAY));
}
}
}
@@ -541,6 +541,7 @@ JsonNode *remmina_stats_get_profiles()
JsonBuilder *b;
JsonNode *r;
+ gchar *s;
gint profiles_count;
GHashTableIter pcountiter, pdateiter;
@@ -559,7 +560,7 @@ JsonNode *remmina_stats_get_profiles()
* not on the main thread */
pdata->proto_date = g_hash_table_new_full(g_str_hash, g_str_equal,
- (GDestroyNotify)g_free, NULL);
+ (GDestroyNotify)g_free, (GDestroyNotify)g_free);
pdata->proto_count = g_hash_table_new_full(g_str_hash, g_str_equal,
(GDestroyNotify)g_free, NULL);
@@ -577,14 +578,23 @@ JsonNode *remmina_stats_get_profiles()
g_hash_table_iter_init(&pdateiter, pdata->proto_date);
while (g_hash_table_iter_next(&pdateiter, &pdatekey, &pdatevalue)) {
- json_builder_set_member_name(b, g_strdup_printf("DATE_%s", (gchar*)pdatekey));
+ s = g_strdup_printf("DATE_%s", (gchar*)pdatekey);
+ json_builder_set_member_name(b, s);
+ g_free(s);
json_builder_add_string_value(b, (gchar*)pdatevalue);
}
json_builder_end_object(b);
r = json_builder_get_root(b);
g_object_unref(b);
+
+ g_hash_table_remove_all(pdata->proto_date);
+ g_hash_table_unref(pdata->proto_date);
+ g_hash_table_remove_all(pdata->proto_count);
+ g_hash_table_unref(pdata->proto_count);
+
g_free(pdata);
+
return r;
}
diff --git a/remmina/src/remmina_stats_sender.c b/remmina/src/remmina_stats_sender.c
index 9052c9304..8bc3657a0 100644
--- a/remmina/src/remmina_stats_sender.c
+++ b/remmina/src/remmina_stats_sender.c
@@ -223,6 +223,9 @@ static gboolean remmina_stats_collector_done(gpointer data)
n = json_builder_get_root(b);
g_object_unref(b);
+ g_free(uid);
+ g_free(enc_s);
+
g = json_generator_new();
json_generator_set_root(g, n);
enc_s = json_generator_to_data(g, NULL); // unenc_s=serialized stats