Commit 68f7fee7 authored by Marc Lehmann's avatar Marc Lehmann

fixed a memory leak, (gimp_destroy_paramdefs) new function. added header.

        * libgimp/gimp.c (gimp_run_procedure2): fixed a memory leak,
        (gimp_destroy_paramdefs) new function.
        * libgimp/gimp.h (gimp_destroy_paramdefs): added header.
        * libgimp/gimpfeatures.h.in (GIMP_HAVE_DESTROY_PARAMDEFS): new macro.
        * plug-ins/script-fu/script-fu.c (init_procedures): fixed a
        big memory leak (this also applied to perl!)
parent 422168e1
Wed Nov 11 02:27:46 CET 1998 Marc Lehmann <pcg@goof.com>
* libgimp/gimp.c (gimp_run_procedure2): fixed a memory leak,
(gimp_destroy_paramdefs) new function.
* libgimp/gimp.h (gimp_destroy_paramdefs): added header.
* libgimp/gimpfeatures.h.in (GIMP_HAVE_DESTROY_PARAMDEFS): new macro.
* plug-ins/script-fu/script-fu.c (init_procedures): fixed a
big memory leak (this also applied to perl!)
Tue Nov 10 23:44:07 MET 1998 Sven Neumann <sven@gimp.org> Tue Nov 10 23:44:07 MET 1998 Sven Neumann <sven@gimp.org>
* libgimp/gimpmatrix.[ch] * libgimp/gimpmatrix.[ch]
......
...@@ -819,6 +819,7 @@ gimp_run_procedure2 (char *name, ...@@ -819,6 +819,7 @@ gimp_run_procedure2 (char *name,
break; break;
} }
g_free (proc_return->name);
g_free (proc_return); g_free (proc_return);
return return_vals; return return_vals;
...@@ -833,6 +834,19 @@ gimp_destroy_params (GParam *params, ...@@ -833,6 +834,19 @@ gimp_destroy_params (GParam *params,
_gp_params_destroy ((GPParam*) params, nparams); _gp_params_destroy ((GPParam*) params, nparams);
} }
void
gimp_destroy_paramdefs (GParamDef *paramdefs,
int nparams)
{
while (nparams--)
{
g_free (paramdefs[nparams].name);
g_free (paramdefs[nparams].description);
}
g_free (paramdefs);
}
gdouble gdouble
gimp_gamma () gimp_gamma ()
{ {
......
...@@ -341,6 +341,13 @@ GParam* gimp_run_procedure2 (char *name, ...@@ -341,6 +341,13 @@ GParam* gimp_run_procedure2 (char *name,
void gimp_destroy_params (GParam *params, void gimp_destroy_params (GParam *params,
int nparams); int nparams);
/* Destroy the an array of GParamDef's. This is useful for
* destroying the return values returned by a call to
* 'gimp_query_procedure'.
*/
void gimp_destroy_paramdefs (GParamDef *paramdefs,
int nparams);
gdouble gimp_gamma (void); gdouble gimp_gamma (void);
gint gimp_install_cmap (void); gint gimp_install_cmap (void);
gint gimp_use_xshm (void); gint gimp_use_xshm (void);
......
...@@ -33,6 +33,7 @@ extern "C" { ...@@ -33,6 +33,7 @@ extern "C" {
#define GIMP_HAVE_GET_DATA_SIZE 1-1-0 #define GIMP_HAVE_GET_DATA_SIZE 1-1-0
#define GIMP_HAVE_PARASITES 1-1-0 #define GIMP_HAVE_PARASITES 1-1-0
#define GIMP_HAVE_RESOLUTION_INFO 1-1-0 #define GIMP_HAVE_RESOLUTION_INFO 1-1-0
#define GIMP_HAVE_DESTROY_PARAMDEFS 1-1-0
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -33,6 +33,7 @@ extern "C" { ...@@ -33,6 +33,7 @@ extern "C" {
#define GIMP_HAVE_GET_DATA_SIZE 1-1-0 #define GIMP_HAVE_GET_DATA_SIZE 1-1-0
#define GIMP_HAVE_PARASITES 1-1-0 #define GIMP_HAVE_PARASITES 1-1-0
#define GIMP_HAVE_RESOLUTION_INFO 1-1-0 #define GIMP_HAVE_RESOLUTION_INFO 1-1-0
#define GIMP_HAVE_DESTROY_PARAMDEFS 1-1-0
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -343,8 +343,8 @@ init_procedures () ...@@ -343,8 +343,8 @@ init_procedures ()
g_free (proc_author); g_free (proc_author);
g_free (proc_copyright); g_free (proc_copyright);
g_free (proc_date); g_free (proc_date);
g_free (params); gimp_destroy_paramdefs (params, nparams);
g_free (return_vals); gimp_destroy_paramdefs (return_vals, nreturn_vals);
} }
} }
......
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