Avoid crashing due to closing of font whose driver pointer is NULL.

src/alloc.c (cleanup_vector): Don't call the font driver's 'close'
 method if the 'driver' pointer is NULL.
This commit is contained in:
Eli Zaretskii 2013-12-14 11:16:10 +02:00
parent 0b32070bbd
commit 95c216526e
2 changed files with 9 additions and 1 deletions

View 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.

View 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. */