changeset 20346:97e5f74f6bc1

(free_fontset_data): Don't free null pointer.
author Richard M. Stallman <rms@gnu.org>
date Tue, 25 Nov 1997 04:49:10 +0000
parents 69818ee01344
children d8e5f3c1618b
files src/fontset.c
diffstat 1 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/fontset.c	Tue Nov 25 04:00:20 1997 +0000
+++ b/src/fontset.c	Tue Nov 25 04:49:10 1997 +0000
@@ -97,19 +97,22 @@
 free_fontset_data (fontset_data)
      struct fontset_data *fontset_data;
 {
-  int i;
-
-  for (i = 0; i < fontset_data->n_fontsets; i++)
+  if (fontset_data->fontset_table)
     {
-      int j;
+      int i;
 
-      xfree (fontset_data->fontset_table[i]->name);
-      for (j = 0; j <= MAX_CHARSET; j++)
-	if (fontset_data->fontset_table[i]->fontname[j])
-	  xfree (fontset_data->fontset_table[i]->fontname[j]);
-      xfree (fontset_data->fontset_table[i]);
+      for (i = 0; i < fontset_data->n_fontsets; i++)
+	{
+	  int j;
+	  
+	  xfree (fontset_data->fontset_table[i]->name);
+	  for (j = 0; j <= MAX_CHARSET; j++)
+	    if (fontset_data->fontset_table[i]->fontname[j])
+	      xfree (fontset_data->fontset_table[i]->fontname[j]);
+	  xfree (fontset_data->fontset_table[i]);
+	}
+      xfree (fontset_data->fontset_table);
     }
-  xfree (fontset_data->fontset_table);
 
   xfree (fontset_data);
 }