Commit 20acaecf authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Fix some sap SD memleaks. more to follow

parent c95e8109
...@@ -470,7 +470,12 @@ static void Close( vlc_object_t *p_this ) ...@@ -470,7 +470,12 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static void CloseDemux( vlc_object_t *p_this ) static void CloseDemux( vlc_object_t *p_this )
{ {
demux_t *p_demux = (demux_t *)p_this;
if( p_demux->p_sys )
{
if( p_demux->p_sys->p_sdp ) FreeSDP( p_demux->p_sys->p_sdp );
free( p_demux->p_sys );
}
} }
/***************************************************************************** /*****************************************************************************
...@@ -514,6 +519,7 @@ static void Run( services_discovery_t *p_sd ) ...@@ -514,6 +519,7 @@ static void Run( services_discovery_t *p_sd )
if( psz_addr && *psz_addr ) if( psz_addr && *psz_addr )
{ {
InitSocket( p_sd, psz_addr, SAP_PORT ); InitSocket( p_sd, psz_addr, SAP_PORT );
free( psz_addr );
} }
if( p_sd->p_sys->i_fd == 0 ) if( p_sd->p_sys->i_fd == 0 )
...@@ -539,18 +545,7 @@ static void Run( services_discovery_t *p_sd ) ...@@ -539,18 +545,7 @@ static void Run( services_discovery_t *p_sd )
if( mdate() - p_sd->p_sys->pp_announces[i]->i_last > i_timeout ) if( mdate() - p_sd->p_sys->pp_announces[i]->i_last > i_timeout )
{ {
struct sap_announce_t *p_announce; RemoveAnnounce( p_sd, p_sd->p_sys->pp_announces[i] );
p_announce = p_sd->p_sys->pp_announces[i];
/* Remove the playlist item */
playlist_LockDeleteAllFromInput( p_sd->p_sys->p_playlist,
p_announce->i_input_id );
/* Remove the sap_announce from the array */
REMOVE_ELEM( p_sd->p_sys->pp_announces,
p_sd->p_sys->i_announces, i );
free( p_announce );
} }
} }
...@@ -760,16 +755,15 @@ static int ParseSAP( services_discovery_t *p_sd, uint8_t *p_buffer, int i_read ) ...@@ -760,16 +755,15 @@ static int ParseSAP( services_discovery_t *p_sd, uint8_t *p_buffer, int i_read )
if( b_need_delete ) if( b_need_delete )
{ {
RemoveAnnounce( p_sd, p_sd->p_sys->pp_announces[i]); RemoveAnnounce( p_sd, p_sd->p_sys->pp_announces[i]);
return VLC_SUCCESS;
} }
else else
{ {
p_sd->p_sys->pp_announces[i]->i_last = mdate(); p_sd->p_sys->pp_announces[i]->i_last = mdate();
}
FreeSDP( p_sdp ); FreeSDP( p_sdp );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
} }
}
/* Add item */ /* Add item */
if( p_sdp->i_media > 1 ) if( p_sdp->i_media > 1 )
{ {
......
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