XFree96 3.1.3Dc - xterm patch #12 - T.Dickey
This corrects a memory leak in xterm that happens whenever one switches fonts.
--- /build/x11r6/XFree86-current/xc/programs/xterm/charproc.c.orig Mon Mar 11 13:48:46 1996
+++ /build/x11r6/XFree86-current/xc/programs/xterm/charproc.c Sat Mar 16 08:48:26 1996
@@ -3632,8 +3632,20 @@
screen->normalboldGC = new_normalboldGC;
screen->reverseGC = new_reverseGC;
screen->reverseboldGC = new_reverseboldGC;
+
+ /* If we're switching fonts, free the old ones. Otherwise we'll leak the
+ * memory that is associated with the old fonts. The XLoadQueryFont call
+ * allocates a new XFontStruct.
+ */
+ if (screen->fnt_bold != 0
+ && screen->fnt_bold != screen->fnt_norm)
+ XFreeFont(screen->display, screen->fnt_bold);
+ if (screen->fnt_norm != 0)
+ XFreeFont(screen->display, screen->fnt_norm);
+
screen->fnt_norm = nfs;
screen->fnt_bold = bfs;
+
screen->enbolden = (nfs == bfs);
set_menu_font (False);
screen->menu_font_number = fontnum;