]> git.sesse.net Git - vlc/commitdiff
* modules/services_discovery/sap.c, modules/codec/x264.c: fixed small mem leaks.
authorGildas Bazin <gbazin@videolan.org>
Tue, 8 Mar 2005 13:15:56 +0000 (13:15 +0000)
committerGildas Bazin <gbazin@videolan.org>
Tue, 8 Mar 2005 13:15:56 +0000 (13:15 +0000)
* modules/stream_out/transcode.c: fixed segfault.

modules/codec/x264.c
modules/services_discovery/sap.c
modules/stream_out/transcode.c

index 7f382698f5970695b92d024903367db7d4d33461..8378e2165ea19af7e4f5e4224eb4d249b43604fa 100644 (file)
@@ -286,6 +286,7 @@ static int  Open ( vlc_object_t *p_this )
         p_sys->param.analyse.inter =
             X264_ANALYSE_I4x4 | X264_ANALYSE_PSUB16x16 | X264_ANALYSE_PSUB8x8;
     }
+    if( val.psz_string ) free( val.psz_string );
 
     if( p_enc->fmt_in.video.i_aspect > 0 )
     {
index 56af26b91359b219100cdc278bad0b81c39bd285..a923eae355a3ad9832b0b45ae9d9ad0f418a4543 100644 (file)
@@ -365,11 +365,9 @@ static int OpenDemux( vlc_object_t *p_this )
     uint8_t *p_peek;
     int i_max_sdp = 1024;
     int i_sdp = 0;
-    char *psz_sdp = (char *)malloc( i_max_sdp );
+    char *psz_sdp = NULL;
     sdp_t *p_sdp = NULL;
 
-    if( !psz_sdp ) return VLC_EGENERIC;
-
     /* Probe for SDP */
     if( p_demux->s )
     {
@@ -383,6 +381,9 @@ static int OpenDemux( vlc_object_t *p_this )
         }
     }
 
+    psz_sdp = (char *)malloc( i_max_sdp );
+    if( !psz_sdp ) return VLC_EGENERIC;
+
     /* Gather the complete sdp file */
     for( ;; )
     {
@@ -424,7 +425,8 @@ static int OpenDemux( vlc_object_t *p_this )
     {
         p_sdp->psz_uri = NULL;
     }
-    if( p_sdp->i_media_type != 33 && p_sdp->i_media_type != 32 && p_sdp->i_media_type != 14 )
+    if( p_sdp->i_media_type != 33 && p_sdp->i_media_type != 32 &&
+        p_sdp->i_media_type != 14 )
         goto error;
 
     if( p_sdp->psz_uri == NULL ) goto error;
index 97611f824abd4cb646bc7f56915dad9b8653200c..9f25e32fd1f4bdc5cdc4dc51ac8c674e43add2cd 100644 (file)
@@ -1490,9 +1490,9 @@ static int transcode_video_process( sout_stream_t *p_stream,
         {
             if( transcode_video_encoder_open( p_stream, id ) != VLC_SUCCESS )
             {
+                p_pic->pf_release( p_pic );
                 transcode_video_close( p_stream, id );
                 id->b_transcode = VLC_FALSE;
-                p_pic->pf_release( p_pic );
                 return VLC_EGENERIC;
             }
 
@@ -1569,9 +1569,9 @@ static int transcode_video_process( sout_stream_t *p_stream,
                     vlc_object_detach( id->pp_filter[id->i_filter] );
                     vlc_object_destroy( id->pp_filter[id->i_filter] );
 
+                    p_pic->pf_release( p_pic );
                     transcode_video_close( p_stream, id );
                     id->b_transcode = VLC_FALSE;
-                    p_pic->pf_release( p_pic );
                     return VLC_EGENERIC;
                 }
             }