]> git.sesse.net Git - vlc/commitdiff
Fix memleaks (corner case).
authorRémi Duraffort <ivoire@videolan.org>
Wed, 2 Jul 2008 21:18:06 +0000 (23:18 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Thu, 3 Jul 2008 20:55:07 +0000 (22:55 +0200)
modules/misc/rtsp.c
modules/stream_out/rtsp.c

index 463af330ecf45c82a94890530ebec33361569d6f..ae7e27754ca80d9f696871d82b9dae1048624f8b 100644 (file)
@@ -492,7 +492,10 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
     /* TODO: update SDP, etc... */
     if( asprintf( &psz_urlc, "%s/trackID=%d",
               p_media->psz_rtsp_path, p_media->i_es ) < 0 )
+    {
+        free( p_es );
         return VLC_ENOMEM;
+    }
     msg_Dbg( p_vod, "  - ES %4.4s (%s)", (char *)&p_fmt->i_codec, psz_urlc );
 
     switch( p_fmt->i_codec )
@@ -583,11 +586,19 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
                 }
                 /* */
                 if( p_64_sps && p_64_pps )
+                {
                     if( asprintf( &p_es->psz_fmtp,
                                   "packetization-mode=1;profile-level-id=%s;"
                                   "sprop-parameter-sets=%s,%s;", hexa, p_64_sps,
                                   p_64_pps ) < 0 )
+                    {
+                        free( p_64_sps );
+                        free( p_64_pps );
+                        free( psz_urlc );
+                        free( p_es );
                         return VLC_ENOMEM;
+                    }
+                }
                 free( p_64_sps );
                 free( p_64_pps );
             }
@@ -649,6 +660,7 @@ static int MediaAddES( vod_t *p_vod, vod_media_t *p_media, es_format_t *p_fmt )
         default:
             msg_Err( p_vod, "cannot add this stream (unsupported "
                     "codec: %4.4s)", (char*)&p_fmt->i_codec );
+            free( psz_urlc );
             free( p_es );
             return VLC_EGENERIC;
     }
index 412ef7ca39b53bfdb43ec570f5756840f603a2cb..30e35526bc87da2150294ab9287a93cafb915265 100644 (file)
@@ -138,6 +138,8 @@ void RtspUnsetup( rtsp_stream_t *rtsp )
 
     free( rtsp->psz_path );
     vlc_mutex_destroy( &rtsp->lock );
+
+    free( rtsp );
 }