[libbluray-devel] bdj: check allocs

hpi1 git at videolan.org
Sun Aug 7 15:59:17 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Aug  7 13:21:07 2016 +0300| [25feb7ca43fb9099cb10d09a371eff786236acab] | committer: hpi1

bdj: check allocs

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=25feb7ca43fb9099cb10d09a371eff786236acab
---

 src/libbluray/bdj/bdj.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 6edd907..1c17eb3 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -296,6 +296,11 @@ static const char *_find_libbluray_jar(BDJ_STORAGE *storage)
             storage->classpath = str_dup(classpath);
         }
 
+        if (!storage->classpath) {
+            BD_DEBUG(DBG_CRIT, "out of memory\n");
+            return NULL;
+        }
+
         if (_can_read_file(storage->classpath)) {
             return storage->classpath;
         }
@@ -311,6 +316,11 @@ static const char *_find_libbluray_jar(BDJ_STORAGE *storage)
     const char *lib_path = dl_get_path();
     if (lib_path) {
         char *cp = str_printf("%s" BDJ_JARFILE, lib_path);
+        if (!cp) {
+            BD_DEBUG(DBG_CRIT, "out of memory\n");
+            return NULL;
+        }
+
         BD_DEBUG(DBG_BDJ, "Checking %s ...\n", cp);
         if (_can_read_file(cp)) {
             storage->classpath = cp;



More information about the libbluray-devel mailing list