]> git.sesse.net Git - vlc/commitdiff
Check malloc return value.
authorRémi Duraffort <ivoire@videolan.org>
Wed, 20 Aug 2008 20:45:24 +0000 (22:45 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 20 Aug 2008 21:22:23 +0000 (23:22 +0200)
modules/meta_engine/taglib.cpp
modules/mux/asf.c

index e6b288d50e3f2b479e5443d4a8d844d2363f525a..b125966f58cbe08e6eaf15437c982f2770534890 100644 (file)
@@ -299,12 +299,15 @@ static int ReadMeta( vlc_object_t *p_this )
                         * terminated string */
                     char *psz_ufid = (char*) malloc( 64 );
                     int j = 0;
-                    while( ( j < 63 ) &&
-                            ( j < p_ufid->identifier().size() ) )
-                        psz_ufid[j] = p_ufid->identifier()[j++];
-                    psz_ufid[j] = '\0';
-                    vlc_meta_SetTrackID( p_meta, psz_ufid );
-                    free( psz_ufid );
+                    if( psz_ufid )
+                    {
+                        while( ( j < 63 ) &&
+                               ( j < p_ufid->identifier().size() ) )
+                            psz_ufid[j] = p_ufid->identifier()[j++];
+                        psz_ufid[j] = '\0';
+                        vlc_meta_SetTrackID( p_meta, psz_ufid );
+                        free( psz_ufid );
+                    }
                 }
             }
 
index f2c3c8c8615dbf6ad3cf5bbdce660c923d974d01..fbcc6081fd3dfa6bd2636d5e522b5b11d9041260 100644 (file)
@@ -201,6 +201,8 @@ static int Open( vlc_object_t *p_this )
     p_mux->pf_mux       = Mux;
 
     p_mux->p_sys = p_sys = malloc( sizeof( sout_mux_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
     p_sys->b_asf_http = p_mux->psz_mux && !strcmp( p_mux->psz_mux, "asfh" );
     if( p_sys->b_asf_http )
     {
@@ -449,6 +451,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             tk->i_extra = sizeof( WAVEFORMATEX ) +
                           p_input->p_fmt->i_extra + i_extra;
             tk->p_extra = malloc( tk->i_extra );
+            if( !tk->p_extra )
+                return VLC_ENOMEM;
             bo_init( &bo, tk->p_extra, tk->i_extra );
             bo_addle_u16( &bo, tk->i_tag );
             bo_addle_u16( &bo, p_input->p_fmt->audio.i_channels );
@@ -506,6 +510,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             tk->i_extra = 11 + sizeof( BITMAPINFOHEADER ) +
                           p_input->p_fmt->i_extra;
             tk->p_extra = malloc( tk->i_extra );
+            if( !tk->p_extra )
+                return VLC_ENOMEM;
             bo_init( &bo, tk->p_extra, tk->i_extra );
             bo_addle_u32( &bo, p_input->p_fmt->video.i_width );
             bo_addle_u32( &bo, p_input->p_fmt->video.i_height );