[gimp/multi-stroke: 30/30] app: memory leak fixes.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/multi-stroke: 30/30] app: memory leak fixes.
- Date: Thu, 4 Jun 2015 17:06:31 +0000 (UTC)
commit 36e4397daff2b509417f713ab76908ecaed718ba
Author: Jehan <jehan girinstud io>
Date: Thu Jun 4 18:53:07 2015 +0200
app: memory leak fixes.
Thanks Massimo:
"The GList* returned by 'gimp_image_symmetry_list' is not freed in few places
and the char* returned by 'gimp_symmetry_parasite_name' is passed directly to
functions that do not free it and so it is leaked."
app/core/gimpsymmetry.c | 11 +++++++++--
app/tools/gimppaintoptions-gui.c | 1 +
app/xcf/xcf-load.c | 1 +
3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpsymmetry.c b/app/core/gimpsymmetry.c
index b5303b3..2d83918 100644
--- a/app/core/gimpsymmetry.c
+++ b/app/core/gimpsymmetry.c
@@ -396,6 +396,7 @@ GimpParasite *
gimp_symmetry_to_parasite (const GimpSymmetry *sym)
{
GimpParasite *parasite;
+ gchar *parasite_name;
gchar *str;
g_return_val_if_fail (GIMP_IS_SYMMETRY (sym), NULL);
@@ -403,9 +404,11 @@ gimp_symmetry_to_parasite (const GimpSymmetry *sym)
str = gimp_config_serialize_to_string (GIMP_CONFIG (sym), NULL);
g_return_val_if_fail (str != NULL, NULL);
- parasite = gimp_parasite_new (gimp_symmetry_parasite_name (sym->type),
+ parasite_name = gimp_symmetry_parasite_name (sym->type);
+ parasite = gimp_parasite_new (parasite_name,
GIMP_PARASITE_PERSISTENT,
strlen (str) + 1, str);
+ g_free (parasite_name);
g_free (str);
return parasite;
@@ -417,13 +420,17 @@ gimp_symmetry_from_parasite (const GimpParasite *parasite,
GType type)
{
GimpSymmetry *symmetry;
+ gchar *parasite_name;
const gchar *str;
GError *error = NULL;
+ parasite_name = gimp_symmetry_parasite_name (type);
+
g_return_val_if_fail (parasite != NULL, NULL);
g_return_val_if_fail (strcmp (gimp_parasite_name (parasite),
- gimp_symmetry_parasite_name (type)) == 0,
+ parasite_name) == 0,
NULL);
+ g_free (parasite_name);
str = gimp_parasite_data (parasite);
g_return_val_if_fail (str != NULL, NULL);
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index 71b515f..8ba2cf2 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -283,6 +283,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
-1);
g_type_class_unref (klass);
}
+ g_list_free (syms);
gtk_list_store_prepend (store, &iter);
gtk_list_store_set (store, &iter,
GIMP_INT_STORE_LABEL, _("None"),
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 798c2f9..6804e01 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -301,6 +301,7 @@ xcf_load_image (Gimp *gimp,
}
}
}
+ g_list_free (iter);
/* migrate the old "exif-data" parasite */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]