[vlc-commits] demux: stl: remove xallocs

Francois Cartegnie git at videolan.org
Wed Jan 25 21:33:01 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jan 25 21:23:28 2017 +0100| [347ce3bc72f8e038140481008bc6e8184751d6be] | committer: Francois Cartegnie

demux: stl: remove xallocs

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=347ce3bc72f8e038140481008bc6e8184751d6be
---

 modules/demux/stl.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/demux/stl.c b/modules/demux/stl.c
index 858dfc7..a9209a5 100644
--- a/modules/demux/stl.c
+++ b/modules/demux/stl.c
@@ -179,12 +179,19 @@ static int Open(vlc_object_t *object)
     const int tti_count = ParseInteger(&header[238], 5);
     msg_Dbg(demux, "Detected EBU STL : CCT=%d TTI=%d start=%8.8s %"PRId64, cct, tti_count, &header[256], program_start);
 
-    demux_sys_t *sys = xmalloc(sizeof(*sys));
+    demux_sys_t *sys = malloc(sizeof(*sys));
+    if(!sys)
+        return VLC_EGENERIC;
+
     sys->next_date = 0;
     sys->current   = 0;
     sys->count     = 0;
-    sys->index     = xcalloc(tti_count, sizeof(*sys->index));
-
+    sys->index     = calloc(tti_count, sizeof(*sys->index));
+    if(!sys->index)
+    {
+        free(sys);
+        return VLC_EGENERIC;
+    }
 
     bool comment = false;
     stl_entry_t *s = &sys->index[0];



More information about the vlc-commits mailing list