[libbluray-devel] nav_title_close(): check for NULL

hpi1 git at videolan.org
Fri Oct 30 11:51:34 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Oct 15 21:29:23 2015 +0300| [6c9a890055d48ae51ac273a76d8f90aa1045298a] | committer: hpi1

nav_title_close(): check for NULL

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

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

diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index 037a09d..31909ef 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -531,19 +531,27 @@ void nav_title_close(NAV_TITLE *title)
 {
     unsigned ii, ss;
 
+    if (!title)
+        return;
+
+    if (title->sub_path) {
     for (ss = 0; ss < title->sub_path_count; ss++) {
+        if (title->sub_path[ss].clip_list.clip) {
         for (ii = 0; ii < title->sub_path[ss].clip_list.count; ii++) {
             clpi_free(title->sub_path[ss].clip_list.clip[ii].cl);
         }
         X_FREE(title->sub_path[ss].clip_list.clip);
+        }
     }
     X_FREE(title->sub_path);
-
-    for (ii = 0; ii < title->pl->list_count; ii++) {
+    }
+    if (title->clip_list.clip) {
+    for (ii = 0; ii < title->clip_list.count; ii++) {
         clpi_free(title->clip_list.clip[ii].cl);
     }
-    mpls_free(title->pl);
     X_FREE(title->clip_list.clip);
+    }
+    mpls_free(title->pl);
     X_FREE(title->chap_list.mark);
     X_FREE(title->mark_list.mark);
     X_FREE(title);



More information about the libbluray-devel mailing list