[vlc-commits] RTSP: use calloc

Jean-Baptiste Kempf git at videolan.org
Fri Dec 11 09:55:30 CET 2015


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Dec 11 09:52:36 2015 +0100| [a3e3a2d1697253d24788dfa398b5404149fc5a6a] | committer: Jean-Baptiste Kempf

RTSP: use calloc

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a3e3a2d1697253d24788dfa398b5404149fc5a6a
---

 modules/stream_out/rtsp.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
index 639e415..dc354d1 100644
--- a/modules/stream_out/rtsp.c
+++ b/modules/stream_out/rtsp.c
@@ -87,21 +87,13 @@ static void RtspTimeOut( void *data );
 rtsp_stream_t *RtspSetup( vlc_object_t *owner, vod_media_t *media,
                           const char *path )
 {
-    rtsp_stream_t *rtsp = malloc( sizeof( *rtsp ) );
+    rtsp_stream_t *rtsp = calloc( 1, sizeof( *rtsp ) );
 
-    if( rtsp == NULL )
-    {
+    if( unlikely(rtsp == NULL) )
         return NULL;
-    }
 
     rtsp->owner = owner;
     rtsp->vod_media = media;
-    rtsp->sessionc = 0;
-    rtsp->sessionv = NULL;
-    rtsp->host = NULL;
-    rtsp->url = NULL;
-    rtsp->psz_path = NULL;
-    rtsp->track_id = 0;
     vlc_mutex_init( &rtsp->lock );
 
     rtsp->timeout = var_InheritInteger(owner, "rtsp-timeout");



More information about the vlc-commits mailing list