[libbluray-devel] Fix leak

hpi1 git at videolan.org
Thu Jul 6 23:29:23 CEST 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Jul  7 00:29:03 2017 +0300| [34cecf100638d4ea3437371eeed26579953ebd6c] | committer: hpi1

Fix leak

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

 src/libbluray/bdnav/mpls_parse.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/libbluray/bdnav/mpls_parse.c b/src/libbluray/bdnav/mpls_parse.c
index 436f897c..1fd181dc 100644
--- a/src/libbluray/bdnav/mpls_parse.c
+++ b/src/libbluray/bdnav/mpls_parse.c
@@ -705,14 +705,14 @@ _parse_playlistmark(BITSTREAM *bits, MPLS_PL *pl)
     // Then get the number of marks
     pl->mark_count = bs_read(bits, 16);
 
-    plm = calloc(pl->mark_count, sizeof(MPLS_PLM));
-    if (pl->mark_count && !plm) {
-        BD_DEBUG(DBG_CRIT, "out of memory\n");
+    if (bs_avail(bits)/(8*14) < pl->mark_count) {
+        BD_DEBUG(DBG_NAV | DBG_CRIT, "_parse_playlistmark: unexpected EOF\n");
         return 0;
     }
 
-    if (bs_avail(bits)/(8*14) < pl->mark_count) {
-        BD_DEBUG(DBG_NAV | DBG_CRIT, "_parse_playlistmark: unexpected EOF\n");
+    plm = calloc(pl->mark_count, sizeof(MPLS_PLM));
+    if (pl->mark_count && !plm) {
+        BD_DEBUG(DBG_CRIT, "out of memory\n");
         return 0;
     }
 



More information about the libbluray-devel mailing list