]> git.sesse.net Git - vlc/blobdiff - modules/stream_filter/hds/hds.c
hds: drop macro
[vlc] / modules / stream_filter / hds / hds.c
index 5402cbb8868db297ab502dfacf01832350d0e98f..37ec06a5e796db1206c63b1b6eef6007ecfcd9e3 100644 (file)
@@ -1009,6 +1009,7 @@ static void maintain_live_chunks(
     hds_stream->chunks_head = chunk;
 }
 
+
 static void* live_thread( void* p )
 {
     vlc_object_t* p_this = (vlc_object_t*)p;
@@ -1028,7 +1029,8 @@ static void* live_thread( void* p )
     if( hds_stream->abst_url &&
         ( isFQUrl( hds_stream->abst_url ) ) )
     {
-        abst_url = strdup ( hds_stream->abst_url );
+        if( !( abst_url = strdup( hds_stream->abst_url ) ) )
+            return NULL;
     }
     else
     {
@@ -1039,7 +1041,7 @@ static void* live_thread( void* p )
                           server_base,
                           hds_stream->abst_url ) )
         {
-            return 0;
+            return NULL;
         }
     }
 
@@ -1148,10 +1150,13 @@ static int parse_Manifest( stream_t *s )
         {
         case XML_READER_STARTELEM:
             if( current_element_idx == 0 && element_stack[current_element_idx] == 0 ) {
-                element_stack[current_element_idx] = strdup( node );
+                if( !( element_stack[current_element_idx] = strdup( node ) ) )
+                    return VLC_ENOMEM;
             } else {
-                element_stack[++current_element_idx] = strdup( node );
+                if ( !( element_stack[++current_element_idx] = strdup( node ) ) )
+                    return VLC_ENOMEM;
             }
+
             break;
         case XML_READER_ENDELEM:
             if( ! strcmp( current_element, "bootstrapInfo") ) {
@@ -1185,15 +1190,18 @@ static int parse_Manifest( stream_t *s )
             {
                 if( !strcmp(attr_name, "streamId" ) )
                 {
-                    medias[media_idx].stream_id = strdup( attr_value );
+                    if( !( medias[media_idx].stream_id = strdup( attr_value ) ) )
+                        return VLC_ENOMEM;
                 }
                 if( !strcmp(attr_name, "url" ) )
                 {
-                    medias[media_idx].media_url = strdup( attr_value );
+                    if( !( medias[media_idx].media_url = strdup( attr_value ) ) )
+                        return VLC_ENOMEM;
                 }
                 if( !strcmp(attr_name, "bootstrapInfoId" ) )
                 {
-                    medias[media_idx].bootstrap_id = strdup( attr_value );
+                    if( !( medias[media_idx].bootstrap_id = strdup( attr_value ) ) )
+                        return VLC_ENOMEM;
                 }
             }
 
@@ -1206,15 +1214,18 @@ static int parse_Manifest( stream_t *s )
             {
                 if( !strcmp(attr_name, "url" ) )
                 {
-                    bootstraps[bootstrap_idx].url = strdup( attr_value );
+                    if( !( bootstraps[bootstrap_idx].url = strdup( attr_value ) ) )
+                        return VLC_ENOMEM;
                 }
                 if( !strcmp(attr_name, "id" ) )
                 {
-                    bootstraps[bootstrap_idx].id = strdup( attr_value );
+                    if( !( bootstraps[bootstrap_idx].id = strdup( attr_value ) ) )
+                       return VLC_ENOMEM;
                 }
                 if( !strcmp(attr_name, "profile" ) )
                 {
-                    bootstraps[bootstrap_idx].profile = strdup( attr_value );
+                    if( !( bootstraps[bootstrap_idx].profile = strdup( attr_value ) ) )
+                        return VLC_ENOMEM;
                 }
             }
         }
@@ -1245,7 +1256,8 @@ static int parse_Manifest( stream_t *s )
                 if( current_element &&
                     ! strcmp( element_stack[current_element_idx-1], "manifest" ) )
                 {
-                    media_id = strdup( node );
+                    if( !( media_id = strdup( node ) ) )
+                        return VLC_ENOMEM;
                 }
             }
         }
@@ -1280,7 +1292,11 @@ static int parse_Manifest( stream_t *s )
 
                 if( medias[i].media_url )
                 {
-                    new_stream->url = strdup( medias[i].media_url );
+                    if( !(new_stream->url = strdup( medias[i].media_url ) ) )
+                    {
+                        free(new_stream);
+                        return VLC_ENOMEM;
+                    }
                 }
 
                 if( ! sys->live )
@@ -1307,7 +1323,11 @@ static int parse_Manifest( stream_t *s )
                 }
                 else
                 {
-                    new_stream->abst_url = strdup( bootstraps[j].url );
+                    if( !(new_stream->abst_url = strdup( bootstraps[j].url ) ) )
+                    {
+                        free(new_stream);
+                        return VLC_ENOMEM;
+                    }
                 }
 
                 vlc_array_append( sys->hds_streams, new_stream );
@@ -1340,6 +1360,7 @@ static int parse_Manifest( stream_t *s )
     return VLC_SUCCESS;
 }
 
+
 static void hds_free( hds_stream_t *p_stream )
 {
     FREENULL( p_stream->quality_segment_modifier );