]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/rtp.c
- Add httpd_ServerIP() to obtain HTTP server's IP used with a given client
[vlc] / modules / stream_out / rtp.c
index 7da13f5f02a363f2ce300883ea5a3ce14b85ec14..3ab642b61ad897d4ec789a35b8bece8721498355 100644 (file)
@@ -1641,7 +1641,7 @@ static int  RtspCallbackId( httpd_callback_sys_t *p_args,
             else if( strstr( psz_transport, "unicast" ) && strstr( psz_transport, "client_port=" ) )
             {
                 int  i_port = atoi( strstr( psz_transport, "client_port=" ) + strlen("client_port=") );
-                char *ip    = httpd_ClientIP( cl );
+                char ip[NI_MAXNUMERICHOST];
 
                 char psz_access[100];
                 char psz_url[100];
@@ -1650,7 +1650,7 @@ static int  RtspCallbackId( httpd_callback_sys_t *p_args,
 
                 rtsp_client_t *rtsp = NULL;
 
-                if( ip == NULL )
+                if( httpd_ClientIP( cl, ip ) == NULL )
                 {
                     answer->i_status = 500;
                     answer->psz_status = strdup( "Internal server error" );
@@ -1679,7 +1679,6 @@ static int  RtspCallbackId( httpd_callback_sys_t *p_args,
                         answer->psz_status = strdup( "Unknown session id" );
                         answer->i_body = 0;
                         answer->p_body = NULL;
-                        free( ip );
                         break;
                     }
                 }
@@ -1690,8 +1689,7 @@ static int  RtspCallbackId( httpd_callback_sys_t *p_args,
                 else
                     sprintf( psz_access, "udp{raw}" );
                 sprintf( psz_url, "%s:%d", ip, i_port );
-                free( ip );
-                
+
                 if( ( p_access = sout_AccessOutNew( p_stream->p_sout, psz_access, psz_url ) ) == NULL )
                 {
                     msg_Err( p_stream, "cannot create the access out for %s://%s",