]> code.delx.au - gnu-emacs/commitdiff
Avoid crashing due to closing of font whose driver pointer is NULL.
authorEli Zaretskii <eliz@gnu.org>
Sat, 14 Dec 2013 09:16:10 +0000 (11:16 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 14 Dec 2013 09:16:10 +0000 (11:16 +0200)
 src/alloc.c (cleanup_vector): Don't call the font driver's 'close'
 method if the 'driver' pointer is NULL.

src/ChangeLog
src/alloc.c

index df145600556e1c94839bc35bf8644c9b2479e812..a9672768b4855c55a5608b5d2c42962652bf51af 100644 (file)
@@ -1,5 +1,8 @@
 2013-12-14  Eli Zaretskii  <eliz@gnu.org>
 
+       * alloc.c (cleanup_vector): Don't call the font driver's 'close'
+       method if the 'driver' pointer is NULL.
+
        * fileio.c (Fcopy_file) [WINDOWSNT]: Move most of the
        Windows-specific code to w32.c.  Change error message text to
        match that of Posix platforms.
index aeda42637cde8ee5688d55fbe7c0da89191d21d6..1cf0f3cc1d2baba27f858992ea5f8ab00a4b0633 100644 (file)
@@ -2877,7 +2877,12 @@ cleanup_vector (struct Lisp_Vector *vector)
   if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT)
       && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK)
          == FONT_OBJECT_MAX))
-    ((struct font *) vector)->driver->close ((struct font *) vector);
+    {
+      struct font *fnt = (struct font *) vector;
+
+      if (fnt->driver)
+       fnt->driver->close ((struct font *) vector);
+    }
 }
 
 /* Reclaim space used by unmarked vectors.  */