[libbluray-devel] simplify

hpi1 git at videolan.org
Tue Jan 27 09:34:42 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Jan  7 14:31:35 2015 +0200| [20d3a1ce4e5c0b60289237aaccf08dc8d7dd999c] | committer: hpi1

simplify

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

 src/libbluray/bdnav/navigation.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index d05ea4a..fb1c339 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -185,9 +185,6 @@ NAV_TITLE_LIST* nav_get_title_list(const char *root, uint32_t flags, uint32_t mi
     NAV_TITLE_LIST *title_list;
     unsigned int title_info_alloc = 100;
 
-    title_list = calloc(1, sizeof(NAV_TITLE_LIST));
-    title_list->title_info = calloc(title_info_alloc, sizeof(NAV_TITLE_INFO));
-
     BD_DEBUG(DBG_NAV, "Root: %s:\n", root);
     path = str_printf("%s" DIR_SEP "BDMV" DIR_SEP "PLAYLIST", root);
 
@@ -195,12 +192,13 @@ NAV_TITLE_LIST* nav_get_title_list(const char *root, uint32_t flags, uint32_t mi
     if (dir == NULL) {
         BD_DEBUG(DBG_NAV, "Failed to open dir: %s\n", path);
         X_FREE(path);
-        X_FREE(title_list->title_info);
-        X_FREE(title_list);
         return NULL;
     }
     X_FREE(path);
 
+    title_list = calloc(1, sizeof(NAV_TITLE_LIST));
+    title_list->title_info = calloc(title_info_alloc, sizeof(NAV_TITLE_INFO));
+
     ii = 0;
     for (res = dir_read(dir, &ent); !res; res = dir_read(dir, &ent)) {
 



More information about the libbluray-devel mailing list