diff options
author | Ewald Snel <esnel@users.sourceforge.net> | 2002-04-23 13:30:42 +0000 |
---|---|---|
committer | Ewald Snel <esnel@users.sourceforge.net> | 2002-04-23 13:30:42 +0000 |
commit | 2238f0536fa7bb4ad6d59ff38ed040dc4d81ff64 (patch) | |
tree | 41c61dbec58d9c610019cf4dade18416c6076d91 /src/xine-engine | |
parent | 8cab88a56f0c9fcaa14ea197ad8a95c58024abfc (diff) | |
download | xine-lib-2238f0536fa7bb4ad6d59ff38ed040dc4d81ff64.tar.gz xine-lib-2238f0536fa7bb4ad6d59ff38ed040dc4d81ff64.tar.bz2 |
Fix memory leaks by disposing input, demux and decoder plugins at exit
- add dispose() function to all decoder plugin structures
CVS patchset: 1763
CVS date: 2002/04/23 13:30:42
Diffstat (limited to 'src/xine-engine')
-rw-r--r-- | src/xine-engine/xine.c | 37 | ||||
-rw-r--r-- | src/xine-engine/xine_internal.h | 6 |
2 files changed, 40 insertions, 3 deletions
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 1606c173d..1b8859991 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.119 2002/04/16 12:27:20 jcdutton Exp $ + * $Id: xine.c,v 1.120 2002/04/23 13:30:44 esnel Exp $ * * top-level xine functions * @@ -455,7 +455,7 @@ int xine_eject (xine_t *this) { void xine_exit (xine_t *this) { - int i; + int i, j; xine_stop(this); @@ -480,6 +480,39 @@ void xine_exit (xine_t *this) { this->metronom->exit (this->metronom); + for (i = 0; i < this->num_demuxer_plugins; i++) + this->demuxer_plugins[i]->close (this->demuxer_plugins[i]); + + for (i = 0; i < this->num_input_plugins; i++) + this->input_plugins[i]->dispose (this->input_plugins[i]); + + for (i = 0; i < DECODER_PLUGIN_MAX; i++) { + if (this->audio_decoder_plugins[i]) { + this->audio_decoder_plugins[i]->dispose (this->audio_decoder_plugins[i]); + + for (j = i + 1; j < DECODER_PLUGIN_MAX; j++) { + if (this->audio_decoder_plugins[j] == this->audio_decoder_plugins[i]) + this->audio_decoder_plugins[j] = NULL; + } + } + if (this->video_decoder_plugins[i]) { + this->video_decoder_plugins[i]->dispose (this->video_decoder_plugins[i]); + + for (j = i + 1; j < DECODER_PLUGIN_MAX; j++) { + if (this->video_decoder_plugins[j] == this->video_decoder_plugins[i]) + this->video_decoder_plugins[j] = NULL; + } + } + if (this->spu_decoder_plugins[i]) { + this->spu_decoder_plugins[i]->dispose (this->spu_decoder_plugins[i]); + + for (j = i + 1; j < DECODER_PLUGIN_MAX; j++) { + if (this->spu_decoder_plugins[j] == this->spu_decoder_plugins[i]) + this->spu_decoder_plugins[j] = NULL; + } + } + } + xine_profiler_print_results (); free (this); diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 51aef162d..423528fa6 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -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_internal.h,v 1.77 2002/04/16 12:27:21 jcdutton Exp $ + * $Id: xine_internal.h,v 1.78 2002/04/23 13:30:44 esnel Exp $ * */ @@ -88,6 +88,8 @@ struct video_decoder_s { char* (*get_identifier) (void); + void (*dispose) (video_decoder_t *this); + int priority; metronom_t *metronom; @@ -120,6 +122,8 @@ struct audio_decoder_s { char* (*get_identifier) (void); + void (*dispose) (audio_decoder_t *this); + int priority; }; |