[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: memory leak in xpm_load
From: |
Juanma Barranquero |
Subject: |
Re: memory leak in xpm_load |
Date: |
Wed, 6 Jun 2007 11:41:24 +0200 |
On 6/6/07, YAMAMOTO Mitsuharu <address@hidden> wrote:
In xpm_load (if HAVE_XPM and ALLOC_XPM_COLORS), xpm_init_color_cache
is called twice without an intervening xpm_free_color_cache call, and
that causes a memory leak ~4KB per XPM image creation.
Try removing the second one; I think it's a leftover from a patch by Chong.
Juanma
Index: src/image.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/image.c,v
retrieving revision 1.70
diff -u -2 -r1.70 image.c
--- src/image.c 3 Jun 2007 00:23:33 -0000 1.70
+++ src/image.c 6 Jun 2007 09:38:34 -0000
@@ -3968,4 +3968,5 @@
attrs.free_colors = xpm_free_colors;
attrs.valuemask |= XpmAllocColor | XpmFreeColors | XpmColorClosure;
+ xpm_init_color_cache (f, &attrs);
#else /* not ALLOC_XPM_COLORS */
/* Let the XPM lib allocate colors. */
@@ -3979,7 +3980,4 @@
#endif /* not XpmAllocCloseColors */
#endif /* ALLOC_XPM_COLORS */
-#ifdef ALLOC_XPM_COLORS
- xpm_init_color_cache (f, &attrs);
-#endif
/* If image specification contains symbolic color definitions, add
@@ -4021,8 +4019,4 @@
/* Create a pixmap for the image, either from a file, or from a
string buffer containing data in the same format as an XPM file. */
-#ifdef ALLOC_XPM_COLORS
- xpm_init_color_cache (f, &attrs);
-#endif
-
specified_file = image_spec_value (img->spec, QCfile, NULL);