]> granicus.if.org Git - handbrake/commitdiff
decsrtsub: fix crash when file can't be opened
authorJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 7 Nov 2018 17:30:53 +0000 (09:30 -0800)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Wed, 7 Nov 2018 17:30:53 +0000 (09:30 -0800)
libhb/decsrtsub.c

index 43269e47d52d1cdc7e162e9a4cb8410daa85b069..d5c17c27eef92890cecd3de33e23a66cb3eed16a 100644 (file)
@@ -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 =