From 06c533b167c37540b578fb1c70d2acb44ce59245 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 9 Jul 2008 20:02:34 +0300 Subject: Fix crash during early exit Starting MPlayer with options such as "-demuxer help" that exit before initializing OSD struct would crash at exit because of a reference to mpctx->osd->sub_font in deinitialization code. Fix by checking that mpctx->osd is not NULL. Checking that osd->sub_font is not NULL was unnecessary because free_font_desc(NULL) is safe. --- mplayer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 3c487d3be6..eb50e37ea2 100644 --- a/mplayer.c +++ b/mplayer.c @@ -670,9 +670,9 @@ void exit_player_with_rc(struct MPContext *mpctx, const char* how, int rc){ #ifdef HAVE_FREETYPE current_module="uninit_font"; - if (mpctx->osd->sub_font && mpctx->osd->sub_font != vo_font) free_font_desc(mpctx->osd->sub_font); - mpctx->osd->sub_font = NULL; - if (vo_font) free_font_desc(vo_font); + if (mpctx->osd && mpctx->osd->sub_font != vo_font) + free_font_desc(mpctx->osd->sub_font); + free_font_desc(vo_font); vo_font = NULL; done_freetype(); #endif -- cgit v1.2.3