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!)
This commit is contained in:
Marc Lehmann 1998-11-11 02:20:29 +00:00
parent 422168e19d
commit 68f7fee7e8
6 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,12 @@
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]

View File

@ -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,
_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 ()
{ {

View File

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

View File

@ -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
} }

View File

@ -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
} }

View File

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