From 33500a415ad19163596aa1c370232f982d6ed5f8 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 18 Sep 2008 16:17:32 +0000 Subject: [PATCH] don't leak the GError. 2008-09-18 Sven Neumann * plug-ins/script-fu/script-fu-scripts.c (script_fu_script_proc): don't leak the GError. svn path=/trunk/; revision=26998 --- ChangeLog | 5 +++++ plug-ins/script-fu/script-fu-scripts.c | 21 ++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98da7e3030..bcfea089bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-09-18 Sven Neumann + + * plug-ins/script-fu/script-fu-scripts.c (script_fu_script_proc): + don't leak the GError. + 2008-09-18 Michael Natterer Bug 552785 – Script-fu run errors do not show in UI diff --git a/plug-ins/script-fu/script-fu-scripts.c b/plug-ins/script-fu/script-fu-scripts.c index a61ad86395..7e84d5b339 100644 --- a/plug-ins/script-fu/script-fu-scripts.c +++ b/plug-ins/script-fu/script-fu-scripts.c @@ -653,8 +653,7 @@ script_fu_install_script (gpointer foo G_GNUC_UNUSED, { SFScript *script = list->data; - script_fu_script_install_proc (script, - script_fu_script_proc); + script_fu_script_install_proc (script, script_fu_script_proc); } return FALSE; @@ -699,10 +698,16 @@ script_fu_script_proc (const gchar *name, gint *nreturn_vals, GimpParam **return_vals) { - static GimpParam values[2]; - GimpPDBStatusType status = GIMP_PDB_SUCCESS; + static GimpParam values[2] = { 0, }; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; SFScript *script; - GError *error = NULL; + GError *error = NULL; + + if (values[1].type == GIMP_PDB_STRING && values[1].data.d_string) + { + g_free (values[1].data.d_string); + values[1].data.d_string = NULL; + } *nreturn_vals = 1; *return_vals = values; @@ -760,6 +765,9 @@ script_fu_script_proc (const gchar *name, *nreturn_vals = 2; values[1].type = GIMP_PDB_STRING; values[1].data.d_string = error->message; + + error->message = NULL; + g_error_free (error); } g_free (command); @@ -782,6 +790,9 @@ script_fu_script_proc (const gchar *name, *nreturn_vals = 2; values[1].type = GIMP_PDB_STRING; values[1].data.d_string = error->message; + + error->message = NULL; + g_error_free (error); } g_free (command);