From: John Stebbins Date: Wed, 7 Nov 2018 17:30:53 +0000 (-0800) Subject: decsrtsub: fix crash when file can't be opened X-Git-Tag: 1.2.0~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48abfc4c6699bd455e49dc9a621aaaf3f47ce894;p=handbrake decsrtsub: fix crash when file can't be opened --- 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 =