[Xpilot-hacks] mem leak in xpilot..

Darel Cullen darelcullen at hotmail.com
Sun Jan 18 10:56:36 AST 2004


Hi,
I found a memory leak in xpilot, seems to be in xpilot 4.5.4 and 4.5.5 and 
xpilot++ patch below f
or xpilot 4.5.4 but should be the same, at first I thought it wasn't that 
bad, but if you are for
example scrolling through the help pages in the about box, you can end up 
with a few hundred k a second being burnt up. And I don't think thats so 
good :(. Basically a missing XFreeFontInfo call f
or the related XQueryFont call.
Hope this didn't get sent twice.


--- xpilot-4.5.4/src/client/about.c     Sat Jun  2 23:00:02 2001
+++ xpilot/src/client/about.c   Sun Jan 18 15:43:30 2004
@@ -92,7 +92,8 @@
                    unsigned long fg, unsigned long bg)
{
     XFontStruct*       font = XQueryFont(dpy, XGContextFromGC(gc));
-    int                        y, x;
+    int                 y, x, tmp;
+    int                 count = 1;
     XWindowAttributes  wattr;

     if (str==NULL || *str=='\0')
@@ -142,7 +143,11 @@
            }
     } while (*str != '\0');

-    return y + font->descent + 1;
+    tmp = font->descent+1;
+
+    XFreeFontInfo(NULL, font, count);
+
+    return y + tmp;
}


Best Regards
/Darel (Colonel Blood)

_________________________________________________________________
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger




More information about the Xpilot-hacks mailing list