]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/rtsp.c
Fix memleaks (corner case).
[vlc] / modules / stream_out / rtsp.c
index 500c7c5c79c820938a6e0e8a9b07574a4d43a96a..30e35526bc87da2150294ab9287a93cafb915265 100644 (file)
@@ -30,7 +30,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_sout.h>
 
 #include <vlc_httpd.h>
@@ -138,6 +138,8 @@ void RtspUnsetup( rtsp_stream_t *rtsp )
 
     free( rtsp->psz_path );
     vlc_mutex_destroy( &rtsp->lock );
+
+    free( rtsp );
 }
 
 
@@ -619,6 +621,14 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
             rtsp_session_t *ses;
             answer->i_status = 200;
 
+            psz_session = httpd_MsgGet( query, "Session" );
+            const char *range = httpd_MsgGet (query, "Range");
+            if (range && strncmp (range, "npt=", 4))
+            {
+                answer->i_status = 501;
+                break;
+            }
+
             vlc_mutex_lock( &rtsp->lock );
             ses = RtspClientGet( rtsp, psz_session );
             if( ses != NULL )
@@ -652,7 +662,6 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
             }
             vlc_mutex_unlock( &rtsp->lock );
 
-            httpd_MsgAdd( answer, "Range", "npt=now-" );
             if( httpd_MsgGet( query, "Scale" ) != NULL )
                 httpd_MsgAdd( answer, "Scale", "1." );
             break;