[vlc-commits] bluray: blurayOpen(): use blurayClose() to clean up after an error

Petri Hintukainen git at videolan.org
Sat Jan 16 17:32:18 CET 2016


vlc | branch: master | Petri Hintukainen <phintuka at gmail.com> | Sat Jan 16 14:44:10 2016 +0200| [b0469c761c0906b5b63ed5c38eca7b4be76a6907] | committer: Jean-Baptiste Kempf

bluray: blurayOpen(): use blurayClose() to clean up after an error

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b0469c761c0906b5b63ed5c38eca7b4be76a6907
---

 modules/access/bluray.c |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 60b7b6c..75a2aa0 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -500,16 +500,15 @@ static int blurayOpen(vlc_object_t *object)
     /* If we're passed a block device, try to convert it to the mount point. */
     FindMountPoint(&p_sys->psz_bd_path);
 
+    vlc_mutex_init(&p_sys->pl_info_lock);
+    vlc_mutex_init(&p_sys->bdj_overlay_lock);
+    var_AddCallback( p_demux->p_input, "intf-event", onIntfEvent, p_demux );
+
     p_sys->bluray = bd_open(p_sys->psz_bd_path, NULL);
     if (!p_sys->bluray) {
-        free(p_sys->psz_bd_path);
-        free(p_sys);
-        return VLC_EGENERIC;
+        goto error;
     }
 
-    vlc_mutex_init(&p_sys->pl_info_lock);
-    vlc_mutex_init(&p_sys->bdj_overlay_lock);
-
     /* Warning the user about AACS/BD+ */
     const BLURAY_DISC_INFO *disc_info = bd_get_disc_info(p_sys->bluray);
 
@@ -633,8 +632,6 @@ static int blurayOpen(vlc_object_t *object)
     if (unlikely(p_sys->p_out == NULL))
         goto error;
 
-    var_AddCallback( p_demux->p_input, "intf-event", onIntfEvent, p_demux );
-
     blurayResetParser(p_demux);
     if (!p_sys->p_parser) {
         msg_Err(p_demux, "Failed to create TS demuxer");
@@ -672,8 +669,9 @@ static void blurayClose(vlc_object_t *object)
      * This will close all the overlays before we release p_vout
      * bd_close(NULL) can crash
      */
-    assert(p_sys->bluray);
-    bd_close(p_sys->bluray);
+    if (p_sys->bluray) {
+        bd_close(p_sys->bluray);
+    }
 
     blurayReleaseVout(p_demux);
 



More information about the vlc-commits mailing list