From 95c216526e3700d46319d8fb47844a5e07662bbf Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 14 Dec 2013 11:16:10 +0200 Subject: [PATCH] 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. --- src/ChangeLog | 3 +++ src/alloc.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index df145600556..a9672768b48 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2013-12-14 Eli Zaretskii + * 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. diff --git a/src/alloc.c b/src/alloc.c index aeda42637cd..1cf0f3cc1d2 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -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. */ -- 2.39.2