summaryrefslogtreecommitdiff
path: root/src/xine-engine/xine.c
diff options
context:
space:
mode:
authorEwald Snel <esnel@users.sourceforge.net>2002-04-23 13:30:42 +0000
committerEwald Snel <esnel@users.sourceforge.net>2002-04-23 13:30:42 +0000
commit2238f0536fa7bb4ad6d59ff38ed040dc4d81ff64 (patch)
tree41c61dbec58d9c610019cf4dade18416c6076d91 /src/xine-engine/xine.c
parent8cab88a56f0c9fcaa14ea197ad8a95c58024abfc (diff)
downloadxine-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/xine.c')
-rw-r--r--src/xine-engine/xine.c37
1 files changed, 35 insertions, 2 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);