]> git.sesse.net Git - vlc/blobdiff - modules/access/rtsp/access.c
Another time "Remove useless test before a free".
[vlc] / modules / access / rtsp / access.c
index 90f3064113c4a6f5cb5390e3e6a93abf14927fa9..d6305e4af351d6207ff838b255f65d257267d461 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 #include <vlc_access.h>
 #include <vlc_interface.h>
@@ -90,7 +94,7 @@ static int RtspConnect( void *p_userdata, char *psz_server, int i_port )
     if( p_sys->fd < 0 )
     {
         msg_Err( p_access, "cannot connect to %s:%d", psz_server, i_port );
-        intf_UserFatal( p_access, VLC_FALSE, _("Connection failed"), 
+        intf_UserFatal( p_access, VLC_FALSE, _("Connection failed"),
                         _("VLC could not connect to \"%s:%d\"."), psz_server, i_port );
         return VLC_EGENERIC;
     }
@@ -127,7 +131,7 @@ static int RtspReadLine( void *p_userdata, uint8_t *p_buffer, int i_buffer )
     if( psz ) strncpy( (char *)p_buffer, psz, i_buffer );
     else *p_buffer = 0;
 
-    if( psz ) free( psz );
+    free( psz );
     return 0;
 }
 
@@ -153,6 +157,14 @@ static int Open( vlc_object_t *p_this )
     char *psz_server = 0;
     int i_result;
 
+    if( !p_access->psz_access || (
+        strncmp( p_access->psz_access, "rtsp", 4 ) &&
+        strncmp( p_access->psz_access, "pnm", 3 )  &&
+        strncmp( p_access->psz_access, "realrtsp", 8 ) ))
+    {
+            return VLC_EGENERIC;
+    }
+
     p_access->pf_read = NULL;
     p_access->pf_block = BlockRead;
     p_access->pf_seek = Seek;
@@ -216,7 +228,7 @@ static int Open( vlc_object_t *p_this )
 
 
             msg_Err( p_access, "rtsp session can not be established" );
-            intf_UserFatal( p_access, VLC_FALSE, _("Session failed"), 
+            intf_UserFatal( p_access, VLC_FALSE, _("Session failed"),
                     _("The requested RTSP session could not be established.") );
             goto error;
         }
@@ -236,11 +248,11 @@ static int Open( vlc_object_t *p_this )
     var_Create( p_access, "realrtsp-caching",
                 VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);
 
-    if( psz_server ) free( psz_server );
+    free( psz_server );
     return VLC_SUCCESS;
 
  error:
-    if( psz_server ) free( psz_server );
+    free( psz_server );
     Close( p_this );
     return VLC_EGENERIC;
 }
@@ -254,7 +266,7 @@ static void Close( vlc_object_t * p_this )
     access_sys_t *p_sys = p_access->p_sys;
 
     if( p_sys->p_rtsp ) rtsp_close( p_sys->p_rtsp );
-    if( p_sys->p_rtsp ) free( p_sys->p_rtsp );
+    free( p_sys->p_rtsp );
     free( p_sys );
 }
 
@@ -342,6 +354,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
         case ACCESS_SET_SEEKPOINT:
         case ACCESS_SET_PRIVATE_ID_STATE:
         case ACCESS_GET_META:
+        case ACCESS_GET_CONTENT_TYPE:
             return VLC_EGENERIC;
 
         default: