[libbluray-devel] Avoid calloc(0)

hpi1 git at videolan.org
Mon Aug 27 08:33:07 CEST 2018


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sat Jan 20 14:08:47 2018 +0200| [672463e317879b61d3a188fc76d31b58df735fc0] | committer: hpi1

Avoid calloc(0)

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

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

diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index 67dc866f..82919c40 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -719,9 +719,13 @@ NAV_TITLE* nav_title_open(BD_DISC *disc, const char *playlist, unsigned angle)
     }
 
     title->chap_list.count = _pl_chapter_count(title->pl);
-    title->chap_list.mark = calloc(title->chap_list.count, sizeof(NAV_MARK));
+    if (title->chap_list.count) {
+        title->chap_list.mark = calloc(title->chap_list.count, sizeof(NAV_MARK));
+    }
     title->mark_list.count = title->pl->mark_count;
-    title->mark_list.mark = calloc(title->pl->mark_count, sizeof(NAV_MARK));
+    if (title->mark_list.count) {
+        title->mark_list.mark = calloc(title->pl->mark_count, sizeof(NAV_MARK));
+    }
 
     _extrapolate_title(title);
 



More information about the libbluray-devel mailing list