From 48abfc4c6699bd455e49dc9a621aaaf3f47ce894 Mon Sep 17 00:00:00 2001 From: John Stebbins Date: Wed, 7 Nov 2018 09:30:53 -0800 Subject: [PATCH] decsrtsub: fix crash when file can't be opened --- libhb/decsrtsub.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libhb/decsrtsub.c b/libhb/decsrtsub.c index 43269e47d..d5c17c27e 100644 --- a/libhb/decsrtsub.c +++ b/libhb/decsrtsub.c @@ -693,6 +693,7 @@ fail: fclose(pv->file); } free(pv); + w->private_data = NULL; } return 1; } @@ -733,9 +734,12 @@ static int decsrtWork( hb_work_object_t * w, hb_buffer_t ** buf_in, static void decsrtClose( hb_work_object_t * w ) { hb_work_private_t * pv = w->private_data; - fclose( pv->file ); - iconv_close(pv->iconv_context); - free( w->private_data ); + if (pv != NULL) + { + fclose( pv->file ); + iconv_close(pv->iconv_context); + free( w->private_data ); + } } hb_work_object_t hb_decsrtsub = -- 2.40.0