app: fix a bunch of valgrind-found leaks

This commit is contained in:
Michael Natterer
2014-07-20 21:40:57 +02:00
parent 3ab1084df7
commit 93c19c20d4
5 changed files with 27 additions and 10 deletions

View File

@ -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);

View File

@ -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)))
{

View File

@ -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);

View File

@ -531,6 +531,8 @@ gimp_viewable_deserialize_property (GimpConfig *config,
}
}
g_free (encoded_image);
g_value_take_object (value, icon_pixbuf);
}
break;

View File

@ -675,6 +675,7 @@ gimp_plug_in_manager_add_from_rc (GimpPlugInManager *manager,
g_free (basename2);
g_free (basename1);
g_free (path1);
return;
}