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/xine-engine/load_plugins.c | |
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/xine-engine/load_plugins.c')
-rw-r--r-- | src/xine-engine/load_plugins.c | 94 |
1 files changed, 64 insertions, 30 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); } |