vlc | branch: master | Hugo Beauzée-Luyssen <[email protected]> | Fri Jun 26 15:21:19 2020 +0200| [72ec520ef19b0e0df1dc4a3502c347bf1ea8d05b] | committer: Hugo Beauzée-Luyssen
microdns: Split srv cleanup in a separate function > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72ec520ef19b0e0df1dc4a3502c347bf1ea8d05b --- modules/services_discovery/microdns.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/services_discovery/microdns.c b/modules/services_discovery/microdns.c index ad0d2691f7..6899185b5b 100644 --- a/modules/services_discovery/microdns.c +++ b/modules/services_discovery/microdns.c @@ -269,6 +269,13 @@ items_clear( struct discovery_sys *p_sys ) vlc_array_clear( &p_sys->items ); } +static void clear_srvs( struct srv *p_srvs, unsigned int i_nb_srv ) +{ + for( unsigned int i = 0; i < i_nb_srv; ++i ) + free( p_srvs[i].psz_device_name ); + free( p_srvs ); +} + static int parse_entries( const struct rr_entry *p_entries, bool b_renderer, struct srv **pp_srvs, unsigned int *p_nb_srv, @@ -356,9 +363,7 @@ parse_entries( const struct rr_entry *p_entries, bool b_renderer, } if( psz_ip == NULL || i_nb_srv == 0 ) { - for( unsigned int i = 0; i < i_nb_srv; ++i ) - free( p_srvs[i].psz_device_name ); - free( p_srvs ); + clear_srvs( p_srvs, i_nb_srv ); return VLC_EGENERIC; } @@ -416,9 +421,7 @@ new_entries_sd_cb( void *p_this, int i_status, const struct rr_entry *p_entries items_add_input( p_sys, p_sd, psz_uri, p_srv->psz_device_name ); } - for( unsigned int i = 0; i < i_nb_srv; ++i ) - free( p_srvs[i].psz_device_name ); - free( p_srvs ); + clear_srvs( p_srvs, i_nb_srv ); } @@ -529,9 +532,7 @@ new_entries_rd_cb( void *p_this, int i_status, const struct rr_entry *p_entries free(psz_icon_uri); } - for( unsigned int i = 0; i < i_nb_srv; ++i ) - free( p_srvs[i].psz_device_name ); - free( p_srvs ); + clear_srvs( p_srvs, i_nb_srv ); } static bool _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
