(x_delete_display): Don't free or derefence NULL pointers.
authorKim F. Storm <storm@cua.dk>
Tue, 4 Jul 2006 14:14:36 +0000 (14:14 +0000)
committerKim F. Storm <storm@cua.dk>
Tue, 4 Jul 2006 14:14:36 +0000 (14:14 +0000)
src/xterm.c

index dfa5f4f..0b16a37 100644 (file)
@@ -10772,12 +10772,16 @@ x_delete_display (dpyinfo)
        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);
+  if (dpyinfo->font_table)
+    {
+      if (dpyinfo->font_table->font_encoder)
+       xfree (dpyinfo->font_table->font_encoder);
+      xfree (dpyinfo->font_table);
+    }
+  if (dpyinfo->x_id_name)
+    xfree (dpyinfo->x_id_name);
+  if (dpyinfo->color_cells)
+    xfree (dpyinfo->color_cells);
   xfree (dpyinfo);
 }