Commit 4f86b958 authored by zorglub's avatar zorglub
Browse files

Fix some memleaks

parent 348c8741
......@@ -243,6 +243,8 @@ struct stats_handler_t
counter_t **pp_counters;
};
VLC_EXPORT( void, stats_HandlerDestroy, (stats_handler_t*) );
#define stats_Update( a,b,c) __stats_Update( VLC_OBJECT( a ), b, c )
VLC_EXPORT( int, __stats_Update, (vlc_object_t*, char *, vlc_value_t) );
#define stats_Create( a,b,c,d ) __stats_Create( VLC_OBJECT(a), b, c, d )
......
......@@ -328,6 +328,7 @@ block_t * block_FifoGet (block_fifo_t *);
mtime_t date_Increment (date_t *, uint32_t);
int playlist_Add (playlist_t *, const char *, const char *, int, int);
char * sout_CfgCreate (char **, sout_cfg_t **, char *);
void stats_HandlerDestroy (stats_handler_t*);
osd_menu_t * __osd_MenuCreate (vlc_object_t *, const char *);
void * vlc_opendir (const char *);
int playlist_NodeRemoveParent (playlist_t *,playlist_item_t*,playlist_item_t *);
......@@ -885,6 +886,7 @@ struct module_symbols_t
void (*stats_ReinitInputStats_inner) (input_stats_t *);
counter_t* (*__stats_CounterGet_inner) (vlc_object_t*, int, char *);
input_thread_t * (*__input_CreateThread2_inner) (vlc_object_t *, input_item_t *, char *);
void (*stats_HandlerDestroy_inner) (stats_handler_t*);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -1313,6 +1315,7 @@ struct module_symbols_t
# define stats_ReinitInputStats (p_symbols)->stats_ReinitInputStats_inner
# define __stats_CounterGet (p_symbols)->__stats_CounterGet_inner
# define __input_CreateThread2 (p_symbols)->__input_CreateThread2_inner
# define stats_HandlerDestroy (p_symbols)->stats_HandlerDestroy_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1744,6 +1747,7 @@ struct module_symbols_t
((p_symbols)->stats_ReinitInputStats_inner) = stats_ReinitInputStats; \
((p_symbols)->__stats_CounterGet_inner) = __stats_CounterGet; \
((p_symbols)->__input_CreateThread2_inner) = __input_CreateThread2; \
((p_symbols)->stats_HandlerDestroy_inner) = stats_HandlerDestroy; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
# endif /* __PLUGIN__ */
......
......@@ -961,6 +961,7 @@ int VLC_CleanUp( int i_object )
while( ( p_stats = vlc_object_find( p_vlc, VLC_OBJECT_STATS, FIND_CHILD) ))
{
stats_HandlerDestroy( p_stats );
vlc_object_detach( (vlc_object_t*) p_stats );
vlc_object_release( (vlc_object_t *)p_stats );
// TODO: Delete it
......
......@@ -44,6 +44,33 @@ static stats_handler_t *stats_HandlerGet( vlc_object_t *p_this );
* Exported functions
*****************************************************************************/
/**
* Cleanup statistics handler stuff
* \param p_stats the handler to clean
* \return nothing
*/
void stats_HandlerDestroy( stats_handler_t *p_stats )
{
int i;
for ( i = p_stats->i_counters - 1 ; i >= 0 ; i-- )
{
int j;
counter * p_counter = p_stats->pp_counters[i];
for( j = p_counter->i_samples -1; j >= 0 ; j-- )
{
counter_sample_t *p_sample = p_counter->pp_samples[j];
if( p_sample->val.psz_string )
free( p_sample->val.psz_string );
REMOVE_ELEM( p_counter->pp_samples, p_counter->i_samples, j );
free( p_sample );
}
free( p_counter->psz_name );
REMOVE_ELEM( p_stats->pp_counters, p_stats->i_counter, i );
free( p_counter );
}
}
/**
* Create a statistics counter
* \param p_this the object for which to create the counter
......
......@@ -1106,6 +1106,7 @@ int vlm_MediaSetup( vlm_t *vlm, vlm_media_t *media, const char *psz_cmd,
vlc_object_destroy( p_input );
}
free( psz_output );
free( psz_header );
if( media->psz_mux )
{
......@@ -1208,6 +1209,7 @@ int vlm_MediaControl( vlm_t *vlm, vlm_media_t *media, const char *psz_id,
vlc_input_item_Clean( &p_instance->item );
if( p_instance->psz_name ) free( p_instance->psz_name );
}
free( psz_header );
return VLC_SUCCESS;
}
......
Supports Markdown
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