Commit 33c8b74c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: destroy the access object underneath the stream_Access object

This simplifies and factors code for stream_Url and input.
Also refs #8414.
parent 1188fc4e
...@@ -2681,9 +2681,6 @@ error: ...@@ -2681,9 +2681,6 @@ error:
if( in->p_stream ) if( in->p_stream )
stream_Delete( in->p_stream ); stream_Delete( in->p_stream );
if( in->p_access )
access_Delete( in->p_access );
free( psz_var_demux ); free( psz_var_demux );
free( psz_dup ); free( psz_dup );
...@@ -2703,9 +2700,6 @@ static void InputSourceClean( input_source_t *in ) ...@@ -2703,9 +2700,6 @@ static void InputSourceClean( input_source_t *in )
if( in->p_stream ) if( in->p_stream )
stream_Delete( in->p_stream ); stream_Delete( in->p_stream );
if( in->p_access )
access_Delete( in->p_access );
if( in->i_title > 0 ) if( in->i_title > 0 )
{ {
for( i = 0; i < in->i_title; i++ ) for( i = 0; i < in->i_title; i++ )
......
...@@ -200,7 +200,6 @@ static int AReadStream( stream_t *s, void *p_read, unsigned int i_read ); ...@@ -200,7 +200,6 @@ static int AReadStream( stream_t *s, void *p_read, unsigned int i_read );
/* Common */ /* Common */
static int AStreamControl( stream_t *s, int i_query, va_list ); static int AStreamControl( stream_t *s, int i_query, va_list );
static void AStreamDestroy( stream_t *s ); static void AStreamDestroy( stream_t *s );
static void UStreamDestroy( stream_t *s );
static int ASeek( stream_t *s, uint64_t i_pos ); static int ASeek( stream_t *s, uint64_t i_pos );
/**************************************************************************** /****************************************************************************
...@@ -249,7 +248,6 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url ) ...@@ -249,7 +248,6 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
{ {
const char *psz_access, *psz_demux, *psz_path, *psz_anchor; const char *psz_access, *psz_demux, *psz_path, *psz_anchor;
access_t *p_access; access_t *p_access;
stream_t *p_res;
if( !psz_url ) if( !psz_url )
return NULL; return NULL;
...@@ -266,14 +264,7 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url ) ...@@ -266,14 +264,7 @@ stream_t *stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
return NULL; return NULL;
} }
if( !( p_res = stream_AccessNew( p_access, NULL ) ) ) return stream_AccessNew( p_access, NULL );
{
access_Delete( p_access );
return NULL;
}
p_res->pf_destroy = UStreamDestroy;
return p_res;
} }
stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list ) stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
...@@ -450,6 +441,7 @@ error: ...@@ -450,6 +441,7 @@ error:
free( p_sys->list ); free( p_sys->list );
free( s->p_sys ); free( s->p_sys );
stream_CommonDelete( s ); stream_CommonDelete( s );
access_Delete( p_access );
return NULL; return NULL;
} }
...@@ -475,18 +467,11 @@ static void AStreamDestroy( stream_t *s ) ...@@ -475,18 +467,11 @@ static void AStreamDestroy( stream_t *s )
free( p_sys->list[p_sys->i_list]->psz_path ); free( p_sys->list[p_sys->i_list]->psz_path );
free( p_sys->list[p_sys->i_list] ); free( p_sys->list[p_sys->i_list] );
} }
free( p_sys->list ); free( p_sys->list );
free( p_sys );
stream_CommonDelete( s ); stream_CommonDelete( s );
} access_Delete( p_sys->p_access );
free( p_sys );
static void UStreamDestroy( stream_t *s )
{
access_t *p_access = (access_t *)s->p_parent;
AStreamDestroy( s );
access_Delete( p_access );
} }
/**************************************************************************** /****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment