[vlc-devel] [RFC 09/38] demux/stl: replaced usage of x{malloc, calloc}

Filip Roséen filip at videolabs.io
Mon Jun 27 13:43:20 CEST 2016


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

diff --git a/modules/demux/stl.c b/modules/demux/stl.c
index 82fd30a..88b6803 100644
--- a/modules/demux/stl.c
+++ b/modules/demux/stl.c
@@ -177,12 +177,21 @@ 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 == NULL )
+        return VLC_ENOMEM;
+
     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( unlikely( !sys->index ) )
+    {
+        free( sys );
+        return VLC_ENOMEM;
+    }
 
     bool comment = false;
     stl_entry_t *s = &sys->index[0];
-- 
2.9.0



More information about the vlc-devel mailing list