diff src/xterm.c @ 52753:551e8ebadb62

Fix memory leaks (from YAMAMOTO Mitsuharu)
author Jan Djärv <jan.h.d@swipnet.se>
date Sun, 05 Oct 2003 12:15:39 +0000
parents 751a01f97570
children d08832a11cfd
line wrap: on
line diff
--- a/src/xterm.c	Sun Oct 05 11:52:47 2003 +0000
+++ b/src/xterm.c	Sun Oct 05 12:15:39 2003 +0000
@@ -10649,6 +10649,8 @@
 x_delete_display (dpyinfo)
      struct x_display_info *dpyinfo;
 {
+  int i;
+
   delete_keyboard_wait_descriptor (dpyinfo->connection);
 
   /* Discard this display from x_display_name_list and x_display_list.
@@ -10700,6 +10702,18 @@
     xim_close_dpy (dpyinfo);
 #endif
 
+  /* Free the font names in the font table.  */
+  for (i = 0; i < dpyinfo->n_fonts; i++)
+    if (dpyinfo->font_table[i].name)
+      {
+	if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name)
+	  xfree (dpyinfo->font_table[i].full_name);
+	xfree (dpyinfo->font_table[i].name);
+      }
+
+  if (dpyinfo->font_table->font_encoder)
+    xfree (dpyinfo->font_table->font_encoder);
+
   xfree (dpyinfo->font_table);
   xfree (dpyinfo->x_id_name);
   xfree (dpyinfo->color_cells);