[gimp] app: fix a bunch of valgrind-found leaks
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: fix a bunch of valgrind-found leaks
- Date: Sun, 20 Jul 2014 19:41:23 +0000 (UTC)
commit 93c19c20d44fae0f5f4443a77ff4979e0fb1bab3
Author: Michael Natterer <mitch gimp org>
Date: Sun Jul 20 21:40:57 2014 +0200
app: fix a bunch of valgrind-found leaks
app/core/gimpdata.c | 28 ++++++++++++++++++----------
app/core/gimpgradient-load.c | 4 ++++
app/core/gimppalette-load.c | 2 ++
app/core/gimpviewable.c | 2 ++
app/plug-in/gimppluginmanager-restore.c | 1 +
5 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/app/core/gimpdata.c b/app/core/gimpdata.c
index 1165731..66b6f6f 100644
--- a/app/core/gimpdata.c
+++ b/app/core/gimpdata.c
@@ -788,12 +788,16 @@ gimp_data_set_file (GimpData *data,
NULL, NULL);
/* and we can write it */
- if (info &&
- g_file_info_get_attribute_boolean (info,
- G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
+ if (info)
{
- private->writable = writable ? TRUE : FALSE;
- private->deletable = deletable ? TRUE : FALSE;
+ if (g_file_info_get_attribute_boolean (info,
+ G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
+ {
+ private->writable = writable ? TRUE : FALSE;
+ private->deletable = deletable ? TRUE : FALSE;
+ }
+
+ g_object_unref (info);
}
}
else /* OR it doesn't exist */
@@ -806,12 +810,16 @@ gimp_data_set_file (GimpData *data,
NULL, NULL);
/* and we can write to its parent directory */
- if (info &&
- g_file_info_get_attribute_boolean (info,
- G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
+ if (info)
{
- private->writable = writable ? TRUE : FALSE;
- private->deletable = deletable ? TRUE : FALSE;
+ if (g_file_info_get_attribute_boolean (info,
+ G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
+ {
+ private->writable = writable ? TRUE : FALSE;
+ private->deletable = deletable ? TRUE : FALSE;
+ }
+
+ g_object_unref (file);
}
g_object_unref (parent);
diff --git a/app/core/gimpgradient-load.c b/app/core/gimpgradient-load.c
index 254c964..8aead74 100644
--- a/app/core/gimpgradient-load.c
+++ b/app/core/gimpgradient-load.c
@@ -193,6 +193,7 @@ gimp_gradient_load (GimpContext *context,
default:
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Corrupt segment %d."), i);
+ g_free (line);
goto failed;
}
}
@@ -200,9 +201,12 @@ gimp_gradient_load (GimpContext *context,
{
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Corrupt segment %d."), i);
+ g_free (line);
goto failed;
}
+ g_free (line);
+
if (( prev && (prev->right < seg->left)) ||
(! prev && (0.0 < seg->left)))
{
diff --git a/app/core/gimppalette-load.c b/app/core/gimppalette-load.c
index 7b5b80e..6a61c9a 100644
--- a/app/core/gimppalette-load.c
+++ b/app/core/gimppalette-load.c
@@ -72,6 +72,8 @@ gimp_palette_load (GimpContext *context,
goto failed;
}
+ g_free (str);
+
palette = g_object_new (GIMP_TYPE_PALETTE,
"mime-type", "application/x-gimp-palette",
NULL);
diff --git a/app/core/gimpviewable.c b/app/core/gimpviewable.c
index 1e76261..3c6d71c 100644
--- a/app/core/gimpviewable.c
+++ b/app/core/gimpviewable.c
@@ -531,6 +531,8 @@ gimp_viewable_deserialize_property (GimpConfig *config,
}
}
+ g_free (encoded_image);
+
g_value_take_object (value, icon_pixbuf);
}
break;
diff --git a/app/plug-in/gimppluginmanager-restore.c b/app/plug-in/gimppluginmanager-restore.c
index 55837ef..ee0d68b 100644
--- a/app/plug-in/gimppluginmanager-restore.c
+++ b/app/plug-in/gimppluginmanager-restore.c
@@ -675,6 +675,7 @@ gimp_plug_in_manager_add_from_rc (GimpPlugInManager *manager,
g_free (basename2);
g_free (basename1);
+ g_free (path1);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]