[libbluray-devel] nav_get_title_list: check allocs

hpi1 git at videolan.org
Sun Aug 21 12:37:21 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Aug 21 13:22:39 2016 +0300| [2dfd3ef045bd45afb6a41b1d78dc5907c03cd191] | committer: hpi1

nav_get_title_list: check allocs

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

 src/libbluray/bdnav/navigation.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index d5b9475..77ed1fb 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -346,7 +346,7 @@ NAV_TITLE_LIST* nav_get_title_list(BD_DISC *disc, uint32_t flags, uint32_t min_t
     MPLS_PL *pl = NULL;
     unsigned int ii, pl_list_size = 0;
     int res;
-    NAV_TITLE_LIST *title_list;
+    NAV_TITLE_LIST *title_list = NULL;
     unsigned int title_info_alloc = 100;
 
     dir = disc_open_dir(disc, "BDMV" DIR_SEP "PLAYLIST");
@@ -355,7 +355,16 @@ NAV_TITLE_LIST* nav_get_title_list(BD_DISC *disc, uint32_t flags, uint32_t min_t
     }
 
     title_list = calloc(1, sizeof(NAV_TITLE_LIST));
+    if (!title_list) {
+        dir_close(dir);
+        return NULL;
+    }
     title_list->title_info = calloc(title_info_alloc, sizeof(NAV_TITLE_INFO));
+    if (!title_list->title_info) {
+        X_FREE(title_list);
+        dir_close(dir);
+        return NULL;
+    }
 
     ii = 0;
     for (res = dir_read(dir, &ent); !res; res = dir_read(dir, &ent)) {



More information about the libbluray-devel mailing list