Alan Coopersmith wrote:
Kate Feng wrote:
To whom it may concern,

On Thursday, July 22, 2010, I sent a patch for libXpm.a to the list
http://www.aps.anl.gov/epics/tech-talk/2010/msg00965.php

That message mentions using a libXpm source that's a decade or so out
of date (libXpm 3.4k) - the latest libXpm release is libXpm 3.5.8 from
last year:
http://www.x.org/releases/individual/lib/libXpm-3.5.8.tar.bz2
The attached file is the patch for this new version.  I hope this helps.

Thanks,
Kate
diff -u create.c.orig create.c

--- create.c.orig 1998-03-19 14:51:00.000000000 -0500

+++ create.c 2010-05-20 09:42:41.000000000 -0400

@@ -929,8 +929,11 @@

if (attributes && (attributes->valuemask & XpmReturnAllocPixels)) {

attributes->alloc_pixels = alloc_pixels;

Your patch got double-spaced by your mailer so won't work - you might
try sending as an attachment if you can't get your mailer to not break it.
(I haven't looked to see if it's correct or not, was just obvious it
 couldn't be used in that format.)

http://www.x.org/wiki/Development/Documentation/SubmittingPatches covers
the preferred ways to send in patches to the mailing list.


--- libXpm-3.5.8/src/create.c.orig	2009-01-30 22:47:16.000000000 -0500
+++ libXpm-3.5.8/src/create.c	2010-08-05 09:06:01.000000000 -0400
@@ -931,8 +931,11 @@
     if (attributes && (attributes->valuemask & XpmReturnAllocPixels)) {
         attributes->alloc_pixels = alloc_pixels;
         attributes->nalloc_pixels = nalloc_pixels;
-    } else
+    } else { 
+      /* Kate Feng, BNL: feeColors() if alloc'ed pixels is not return. Otherwise, memory leaks */
+        (*freeColors)(display, colormap, alloc_pixels, nalloc_pixels, NULL);
         XpmFree(alloc_pixels);
+    }
 
     /* return created images */
     if (image_return)
@@ -2268,8 +2271,11 @@
     if (attributes && (attributes->valuemask & XpmReturnAllocPixels)) {
         attributes->alloc_pixels = alloc_pixels;
         attributes->nalloc_pixels = nalloc_pixels;
-    } else
-        XpmFree(alloc_pixels);
+    } else {
+      /* Kate Feng: feeColors() if alloc'ed pixels is not return. Otherwise, memory leaks */
+       (*freeColors)(display, colormap, alloc_pixels, nalloc_pixels, NULL);
+       XpmFree(alloc_pixels);
+    }
 
     /* return created images */
     if (image_return)
_______________________________________________
[email protected]: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: [email protected]

Reply via email to