Commit b6efff7e authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

plugged more file descriptor leaks.

2004-08-10  Sven Neumann  <sven@gimp.org>

	* app/core/gimpbrushgenerated.c (gimp_brush_generated_load):
	plugged more file descriptor leaks.
parent 09ad565e
2004-08-10 Sven Neumann <sven@gimp.org>
* app/core/gimpbrushgenerated.c (gimp_brush_generated_load):
plugged more file descriptor leaks.
2004-08-10 DindinX <david@dindinx.org>
* app/core/gimpbrushgenerated.c: don't leak a file descriptor when
......
......@@ -578,12 +578,12 @@ gimp_brush_generated_load (const gchar *filename,
GimpBrushGenerated *brush;
FILE *file;
gchar string[256];
gchar *name = NULL;
GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE;
gchar *name = NULL;
GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE;
gboolean have_shape = FALSE;
gint spikes = 2;
gdouble spacing;
gdouble radius;
gint spikes = 2;
gdouble hardness;
gdouble aspect_ratio;
gdouble angle;
......@@ -613,7 +613,7 @@ gimp_brush_generated_load (const gchar *filename,
_("Fatal parse error in brush file '%s': "
"Not a GIMP brush file."),
gimp_filename_to_utf8 (filename));
return NULL;
goto failed;
}
/* make sure we are reading a compatible version */
......@@ -629,7 +629,7 @@ gimp_brush_generated_load (const gchar *filename,
_("Fatal parse error in brush file '%s': "
"Unknown GIMP brush version."),
gimp_filename_to_utf8 (filename));
return NULL;
goto failed;
}
else
{
......@@ -668,8 +668,7 @@ gimp_brush_generated_load (const gchar *filename,
_("Fatal parse error in brush file '%s': "
"Unknown GIMP brush shape."),
gimp_filename_to_utf8 (filename));
g_free (name);
return NULL;
goto failed;
}
shape = shape_val->value;
......@@ -745,10 +744,11 @@ gimp_brush_generated_load (const gchar *filename,
if (name)
g_free (name);
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Error while reading brush file '%s': %s"),
gimp_filename_to_utf8 (filename),
errno ? g_strerror (errno) : _("File is truncated"));
if (error && *error == NULL)
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Error while reading brush file '%s': %s"),
gimp_filename_to_utf8 (filename),
errno ? g_strerror (errno) : _("File is truncated"));
return NULL;
}
......
......@@ -578,12 +578,12 @@ gimp_brush_generated_load (const gchar *filename,
GimpBrushGenerated *brush;
FILE *file;
gchar string[256];
gchar *name = NULL;
GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE;
gchar *name = NULL;
GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE;
gboolean have_shape = FALSE;
gint spikes = 2;
gdouble spacing;
gdouble radius;
gint spikes = 2;
gdouble hardness;
gdouble aspect_ratio;
gdouble angle;
......@@ -613,7 +613,7 @@ gimp_brush_generated_load (const gchar *filename,
_("Fatal parse error in brush file '%s': "
"Not a GIMP brush file."),
gimp_filename_to_utf8 (filename));
return NULL;
goto failed;
}
/* make sure we are reading a compatible version */
......@@ -629,7 +629,7 @@ gimp_brush_generated_load (const gchar *filename,
_("Fatal parse error in brush file '%s': "
"Unknown GIMP brush version."),
gimp_filename_to_utf8 (filename));
return NULL;
goto failed;
}
else
{
......@@ -668,8 +668,7 @@ gimp_brush_generated_load (const gchar *filename,
_("Fatal parse error in brush file '%s': "
"Unknown GIMP brush shape."),
gimp_filename_to_utf8 (filename));
g_free (name);
return NULL;
goto failed;
}
shape = shape_val->value;
......@@ -745,10 +744,11 @@ gimp_brush_generated_load (const gchar *filename,
if (name)
g_free (name);
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Error while reading brush file '%s': %s"),
gimp_filename_to_utf8 (filename),
errno ? g_strerror (errno) : _("File is truncated"));
if (error && *error == NULL)
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Error while reading brush file '%s': %s"),
gimp_filename_to_utf8 (filename),
errno ? g_strerror (errno) : _("File is truncated"));
return NULL;
}
......
......@@ -578,12 +578,12 @@ gimp_brush_generated_load (const gchar *filename,
GimpBrushGenerated *brush;
FILE *file;
gchar string[256];
gchar *name = NULL;
GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE;
gchar *name = NULL;
GimpBrushGeneratedShape shape = GIMP_BRUSH_GENERATED_CIRCLE;
gboolean have_shape = FALSE;
gint spikes = 2;
gdouble spacing;
gdouble radius;
gint spikes = 2;
gdouble hardness;
gdouble aspect_ratio;
gdouble angle;
......@@ -613,7 +613,7 @@ gimp_brush_generated_load (const gchar *filename,
_("Fatal parse error in brush file '%s': "
"Not a GIMP brush file."),
gimp_filename_to_utf8 (filename));
return NULL;
goto failed;
}
/* make sure we are reading a compatible version */
......@@ -629,7 +629,7 @@ gimp_brush_generated_load (const gchar *filename,
_("Fatal parse error in brush file '%s': "
"Unknown GIMP brush version."),
gimp_filename_to_utf8 (filename));
return NULL;
goto failed;
}
else
{
......@@ -668,8 +668,7 @@ gimp_brush_generated_load (const gchar *filename,
_("Fatal parse error in brush file '%s': "
"Unknown GIMP brush shape."),
gimp_filename_to_utf8 (filename));
g_free (name);
return NULL;
goto failed;
}
shape = shape_val->value;
......@@ -745,10 +744,11 @@ gimp_brush_generated_load (const gchar *filename,
if (name)
g_free (name);
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Error while reading brush file '%s': %s"),
gimp_filename_to_utf8 (filename),
errno ? g_strerror (errno) : _("File is truncated"));
if (error && *error == NULL)
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Error while reading brush file '%s': %s"),
gimp_filename_to_utf8 (filename),
errno ? g_strerror (errno) : _("File is truncated"));
return NULL;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment