diff options
author | Ewald Snel <esnel@users.sourceforge.net> | 2002-11-14 19:45:01 +0000 |
---|---|---|
committer | Ewald Snel <esnel@users.sourceforge.net> | 2002-11-14 19:45:01 +0000 |
commit | dd8530be7f27c2a42e1adb7ab9363a3604d7c493 (patch) | |
tree | 47f2de920a72a8456e9c36698c38e7a36031db76 /src | |
parent | 5e683f0ee847486cf4b5556e95c383b0568374c1 (diff) | |
download | xine-lib-dd8530be7f27c2a42e1adb7ab9363a3604d7c493.tar.gz xine-lib-dd8530be7f27c2a42e1adb7ab9363a3604d7c493.tar.bz2 |
Fix memory leaks
CVS patchset: 3260
CVS date: 2002/11/14 19:45:01
Diffstat (limited to 'src')
-rw-r--r-- | src/xine-engine/load_plugins.c | 94 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 21 |
2 files changed, 72 insertions, 43 deletions
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 856f2140f..b838f589e 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: load_plugins.c,v 1.112 2002/11/12 00:13:14 guenter Exp $ + * $Id: load_plugins.c,v 1.113 2002/11/14 19:45:01 esnel Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -1452,45 +1452,79 @@ char *xine_get_mime_types (xine_t *self) { } -/* - * dispose all currently loaded plugins (shutdown) - */ - -void dispose_plugins (xine_t *this) { - -/* FIXME */ +static void dispose_plugin_list (xine_list_t *list) { -#if 0 plugin_node_t *node; + decoder_info_t *decoder_info; - node = xine_list_first_content (this->plugin_catalog->demux); + node = xine_list_first_content (list); while (node) { - demux_plugin_t *dp = node->plugin; - - if (dp) - dp->dispose (dp); - - node = xine_list_next_content (this->plugin_catalog->demux); - } + if (node->plugin_class) { + void *cls = node->plugin_class; + + /* dispose of plugin class */ + switch (node->info->type) { + case PLUGIN_INPUT: + ((input_class_t *)cls)->dispose ((input_class_t *)cls); + break; + case PLUGIN_DEMUX: + ((demux_class_t *)cls)->dispose ((demux_class_t *)cls); + break; + case PLUGIN_SPU_DECODER: + ((spu_decoder_class_t *)cls)->dispose ((spu_decoder_class_t *)cls); + break; + case PLUGIN_AUDIO_DECODER: + ((audio_decoder_class_t *)cls)->dispose ((audio_decoder_class_t *)cls); + break; + case PLUGIN_VIDEO_DECODER: + ((video_decoder_class_t *)cls)->dispose ((video_decoder_class_t *)cls); + break; + case PLUGIN_AUDIO_OUT: + ((audio_driver_class_t *)cls)->dispose ((audio_driver_class_t *)cls); + break; + case PLUGIN_VIDEO_OUT: + ((video_driver_class_t *)cls)->dispose ((video_driver_class_t *)cls); + break; + } + } - node = xine_list_first_content (this->plugin_catalog->input); - while (node) { - input_plugin_t *ip = node->plugin; + /* free special info */ + switch (node->info->type) { + case PLUGIN_SPU_DECODER: + case PLUGIN_AUDIO_DECODER: + case PLUGIN_VIDEO_DECODER: + decoder_info = (decoder_info_t *)node->info->special_info; + free (decoder_info->supported_types); + + default: + free (node->info->special_info); + break; + } - if (ip) - ip->dispose (ip); + /* free info structure and string copies */ + free (node->info->id); + free (node->info); + free (node->filename); + free (node); - node = xine_list_next_content (this->plugin_catalog->input); + node = xine_list_next_content (list); } +} - for (i = 0; i < this->num_audio_decoders_loaded; i++) - this->audio_decoders_loaded[i]->dispose (this->audio_decoders_loaded[i]); - for (i = 0; i < this->num_video_decoders_loaded; i++) - this->video_decoders_loaded[i]->dispose (this->video_decoders_loaded[i]); +/* + * dispose all currently loaded plugins (shutdown) + */ - for (i = 0; i < this->num_spu_decoders_loaded; i++) - this->spu_decoders_loaded[i]->dispose (this->spu_decoders_loaded[i]); +void dispose_plugins (xine_t *this) { -#endif + dispose_plugin_list (this->plugin_catalog->input); + dispose_plugin_list (this->plugin_catalog->demux); + dispose_plugin_list (this->plugin_catalog->spu); + dispose_plugin_list (this->plugin_catalog->audio); + dispose_plugin_list (this->plugin_catalog->video); + dispose_plugin_list (this->plugin_catalog->aout); + dispose_plugin_list (this->plugin_catalog->vout); + + free (this->plugin_catalog); } diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index fa9c9a2d0..7d4fe2c63 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.191 2002/11/11 00:54:08 miguelfreitas Exp $ + * $Id: xine.c,v 1.192 2002/11/14 19:45:01 esnel Exp $ * * top-level xine functions * @@ -805,29 +805,24 @@ void xine_dispose (xine_stream_t *stream) { pthread_mutex_destroy (&stream->event_queues_lock); pthread_cond_destroy (&stream->counter_changed); + stream->metronom->exit (stream->metronom); + free (stream); } void xine_exit (xine_t *this) { - /* FIXME */ + int i; printf ("xine_exit: bye!\n"); -#if 0 - - int i; - for (i = 0; i < XINE_LOG_NUM; i++) - stream->log_buffers[i]->dispose (stream->log_buffers[i]); + this->log_buffers[i]->dispose (this->log_buffers[i]); - stream->metronom->exit (stream->metronom); + dispose_plugins (this); + this->config->dispose(this->config); - dispose_plugins (stream); - xine_profiler_print_results (); - stream->config->dispose(stream->config); - -#endif + free (this); } xine_t *xine_new (void) { |