[libbluray-devel] fix crash when disc_init() fails
hpi1
git at videolan.org
Fri Mar 20 13:43:39 CET 2015
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Mar 20 14:42:09 2015 +0200| [9bf8997a039ca46548ab54bb28257c0149ac45f0] | committer: hpi1
fix crash when disc_init() fails
Not likely, but possible (failed malloc would cause this).
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=9bf8997a039ca46548ab54bb28257c0149ac45f0
---
src/libbluray/bluray.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 94a1072..e05b61d 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -1300,16 +1300,20 @@ BLURAY *bd_open(const char *device_path, const char *keyfile_path)
return NULL;
}
+ bd_mutex_init(&bd->mutex);
+#ifdef USING_BDJAVA
+ bd_mutex_init(&bd->argb_buffer_mutex);
+#endif
+
bd->disc = disc_open(device_path,
&enc_info, keyfile_path,
(void*)bd->regs, (void*)bd_psr_read, (void*)bd_psr_write);
- _fill_disc_info(bd, &enc_info);
+ if (!bd->disc) {
+ return bd;
+ }
- bd_mutex_init(&bd->mutex);
-#ifdef USING_BDJAVA
- bd_mutex_init(&bd->argb_buffer_mutex);
-#endif
+ _fill_disc_info(bd, &enc_info);
BD_DEBUG(DBG_BLURAY, "BLURAY initialized!\n");
More information about the libbluray-devel
mailing list