[Gimp-developer] Fixes for memory leaks
Hi! While giving a look at bug #595605 (from Gimp Bugzilla), I have remembered about cppcheck. I have created a patch available at http://people.debian.org/~naoliv/misc/gimp-mememleak.diff fixing (I hope) some leakages inside the plug-ins dir. Can somebody review it, please? There are some errors remaining (that or seemed to be unnecessary to fix or I couldn't find an easy way to fix): [./common/file-compressor.c:775]: (error) Memory leak: filename_copy [./common/file-xmc.c:888]: (error) Memory leak: positions [./common/mail.c:610]: (error) Memory leak: filename_copy [./common/plugin-browser.c:329]: (error) Memory leak: tmp_ptr [./common/plugin-browser.c:355]: (error) Memory leak: leaf_ptr [./file-psd/psd-util.c:200]: (error) Memory leak: pascal_str [./flame/libifs.c:1234]: (error) Memory leak: points [./file-xjt/xjt.c:3138]: (error) Memory leak: l_file_buff [./gfig/gfig-star.c:222]: (error) Memory leak: line_pnts [./gfig/gfig-star.c:222]: (error) Memory leak: min_max A run on the full source code of gimp (version is the latest one from git), also gives some messages: http://people.debian.org/~naoliv/misc/gimp-ccpcheck.txt Thank you! Best regards, Nelson ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] Scope of variables
Hi! Is it interesting to limit the scope of the variables to where they are only used? For example, i is not used inside only one if here in app/core/gimpimage-convert.c (and thus has been moved to where it's only necessary): --- app/core/gimpimage-convert.c.old2009-11-18 00:18:55.0 -0200 +++ app/core/gimpimage-convert.c2009-11-18 00:19:34.0 -0200 @@ -835,8 +835,6 @@ /* Convert to indexed? Build histogram if necessary. */ if (new_type == GIMP_INDEXED) { - gint i; - /* fprintf(stderr, TO INDEXED(%d) , num_cols); */ /* don't dither if the input is grayscale and we are simply @@ -897,6 +895,7 @@ ! needs_quantize palette_type == GIMP_MAKE_PALETTE) { + gint i; /* If this is an RGB image, and the user wanted a custom-built * generated palette, and this image has no more colours than * the user asked for, we don't need the first pass (quantization). Are these kind of minor changes interesting for Gimp, please? Thank you! Best regards, Nelson ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] Scope of variables
Hi again! On Wed, Nov 18, 2009 at 12:23 AM, Nelson A. de Oliveira nao...@gmail.com wrote: For example, i is not used inside only one if here in app/core/gimpimage-convert.c (and thus has been moved to where it's only necessary): I need to sleep. Read it as: For example, i is used inside only one if here in app/core/gimpimage-convert.c ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer