summaryrefslogtreecommitdiff
path: root/src/input
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/input
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/input')
-rw-r--r--src/input/input_cda.c16
-rw-r--r--src/input/input_dvd.c18
-rw-r--r--src/input/input_file.c16
-rw-r--r--src/input/input_http.c5
-rw-r--r--src/input/input_mms.c5
-rw-r--r--src/input/input_net.c5
-rw-r--r--src/input/input_plugin.h7
-rw-r--r--src/input/input_rtp.c26
-rw-r--r--src/input/input_stdin_fifo.c7
-rw-r--r--src/input/input_vcd.c14
10 files changed, 113 insertions, 6 deletions
diff --git a/src/input/input_cda.c b/src/input/input_cda.c
index bdf2a881b..fb7defe66 100644
--- a/src/input/input_cda.c
+++ b/src/input/input_cda.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: input_cda.c,v 1.19 2002/04/11 22:27:11 jcdutton Exp $
+ * $Id: input_cda.c,v 1.20 2002/04/23 13:30:42 esnel Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -1768,6 +1768,19 @@ static int cda_plugin_get_optional_data (input_plugin_t *this_gen, void *data, i
return INPUT_OPTIONAL_UNSUPPORTED;
}
+static int cda_plugin_dispose (input_plugin_t *this_gen ) {
+ cda_input_plugin_t *this = (cda_input_plugin_t *) this_gen;
+ int i;
+
+ for (i = 0; i < 100; i++)
+ free (this->filelist[i]);
+
+ free (this->cda->device_name);
+ free (this->cda);
+ free (this->mrls);
+ free (this);
+}
+
/*
* Initialize plugin.
*/
@@ -1813,6 +1826,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_mrl = cda_plugin_get_mrl;
this->input_plugin.get_autoplay_list = cda_plugin_get_autoplay_list;
this->input_plugin.get_optional_data = cda_plugin_get_optional_data;
+ this->input_plugin.dispose = cda_plugin_dispose;
this->input_plugin.is_branch_possible = NULL;
this->xine = xine;
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index 739d5e173..e0a69fd6c 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.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: input_dvd.c,v 1.44 2002/04/11 22:27:11 jcdutton Exp $
+ * $Id: input_dvd.c,v 1.45 2002/04/23 13:30:42 esnel Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -786,6 +786,21 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen,
return INPUT_OPTIONAL_UNSUPPORTED;
}
+static int dvd_plugin_dispose (input_plugin_t *this_gen ) {
+ dvd_input_plugin_t *this = (dvd_input_plugin_t *) this_gen;
+ int i;
+
+ read_cache_free (this->read_cache);
+
+ for (i = 0; i < MAX_DIR_ENTRIES; i++) {
+ free (this->filelist[i]);
+ free (this->filelist2[i]);
+ }
+
+ free (this->mrls);
+ free (this);
+}
+
input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
@@ -830,6 +845,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_mrl = dvd_plugin_get_mrl;
this->input_plugin.get_autoplay_list = dvd_plugin_get_autoplay_list;
this->input_plugin.get_optional_data = dvd_plugin_get_optional_data;
+ this->input_plugin.dispose = dvd_plugin_dispose;
this->input_plugin.is_branch_possible= NULL;
/* disable branch until we fix the problems branching from
menu vob to video vob
diff --git a/src/input/input_file.c b/src/input/input_file.c
index de98d55a8..9aa4e7ce9 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.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: input_file.c,v 1.43 2002/04/16 14:26:46 guenter Exp $
+ * $Id: input_file.c,v 1.44 2002/04/23 13:30:43 esnel Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -277,6 +277,9 @@ static int file_plugin_open (input_plugin_t *this_gen, char *mrl) {
char *filename, *subtitle;
file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
+ if (this->mrl)
+ free (this->mrl);
+
this->mrl = strdup(mrl); /* FIXME: small memory leak */
if (!strncasecmp (this->mrl, "file:",5))
@@ -833,6 +836,16 @@ static int file_plugin_get_optional_data (input_plugin_t *this_gen,
return INPUT_OPTIONAL_UNSUPPORTED;
}
+static int file_plugin_dispose (input_plugin_t *this_gen ) {
+ file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
+
+ if (this->mrl)
+ free (this->mrl);
+
+ free (this->mrls);
+ free (this);
+}
+
/*
*
*/
@@ -873,6 +886,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_identifier = file_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = file_plugin_get_optional_data;
+ this->input_plugin.dispose = file_plugin_dispose;
this->input_plugin.is_branch_possible = NULL;
this->fh = -1;
diff --git a/src/input/input_http.c b/src/input/input_http.c
index e0b09d1a4..8cf804ad6 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -659,6 +659,10 @@ static int http_plugin_get_optional_data (input_plugin_t *this_gen,
return INPUT_OPTIONAL_UNSUPPORTED;
}
+static int http_plugin_dispose (input_plugin_t *this_gen ) {
+ free (this_gen);
+}
+
input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
http_input_plugin_t *this;
@@ -696,6 +700,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_identifier = http_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = http_plugin_get_optional_data;
+ this->input_plugin.dispose = http_plugin_dispose;
this->input_plugin.is_branch_possible= NULL;
this->fh = -1;
diff --git a/src/input/input_mms.c b/src/input/input_mms.c
index a323e9d1c..a4888d4cb 100644
--- a/src/input/input_mms.c
+++ b/src/input/input_mms.c
@@ -308,6 +308,10 @@ static int mms_plugin_get_optional_data (input_plugin_t *this_gen,
return INPUT_OPTIONAL_UNSUPPORTED;
}
+static int mms_plugin_dispose (input_plugin_t *this_gen ) {
+ free (this_gen);
+}
+
input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
@@ -345,6 +349,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_identifier = mms_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = mms_plugin_get_optional_data;
+ this->input_plugin.dispose = mms_plugin_dispose;
this->input_plugin.is_branch_possible= NULL;
this->mrl = NULL;
diff --git a/src/input/input_net.c b/src/input/input_net.c
index 066d90258..2e986b82d 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -325,6 +325,10 @@ static int net_plugin_get_optional_data (input_plugin_t *this_gen,
return INPUT_OPTIONAL_UNSUPPORTED;
}
+static int net_plugin_dispose (input_plugin_t *this_gen ) {
+ free (this_gen);
+}
+
/*
*
*/
@@ -365,6 +369,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_identifier = net_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = net_plugin_get_optional_data;
+ this->input_plugin.dispose = net_plugin_dispose;
this->input_plugin.is_branch_possible= NULL;
this->fh = -1;
diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h
index 703b959e3..a3b753e93 100644
--- a/src/input/input_plugin.h
+++ b/src/input/input_plugin.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: input_plugin.h,v 1.22 2002/04/11 22:27:11 jcdutton Exp $
+ * $Id: input_plugin.h,v 1.23 2002/04/23 13:30:43 esnel Exp $
*/
#ifndef HAVE_INPUT_PLUGIN_H
@@ -273,6 +273,11 @@ struct input_plugin_s
*/
int (*is_branch_possible) (input_plugin_t *this, char *next_mrl);
+
+ /*
+ * free resources
+ */
+ void (*dispose) (input_plugin_t *this);
};
/*
diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c
index 2d6097992..ad73e5e1d 100644
--- a/src/input/input_rtp.c
+++ b/src/input/input_rtp.c
@@ -476,6 +476,31 @@ static int rtp_plugin_get_optional_data (input_plugin_t *this_gen,
return INPUT_OPTIONAL_UNSUPPORTED;
}
+static int rtp_plugin_dispose (input_plugin_t *this_gen ) {
+ rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen;
+ input_buffer_t *buf;
+
+ if (this->fifo_tail.next) {
+ while (this->fifo_tail.next != &this->fifo_tail) {
+ buf = this->fifo_tail.next->buf;
+ this->fifo_tail.next = this->fifo_tail.next->next;
+
+ free (buf->buf);
+ free (buf);
+ }
+ }
+
+ while (this->free_buffers) {
+ buf = this->free_buffers;
+ this->free_buffers = this->free_buffers->next;
+
+ free (buf->buf);
+ free (buf);
+ }
+
+ free (this);
+}
+
/*
*
*/
@@ -533,6 +558,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_mrl = rtp_plugin_get_mrl;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = rtp_plugin_get_optional_data;
+ this->input_plugin.dispose = rtp_plugin_dispose;
this->input_plugin.is_branch_possible= NULL;
this->fh = -1;
diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
index 117f22fa8..37df10a64 100644
--- a/src/input/input_stdin_fifo.c
+++ b/src/input/input_stdin_fifo.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: input_stdin_fifo.c,v 1.22 2002/03/23 18:56:55 guenter Exp $
+ * $Id: input_stdin_fifo.c,v 1.23 2002/04/23 13:30:43 esnel Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -341,6 +341,10 @@ static int stdin_plugin_get_optional_data (input_plugin_t *this_gen,
return INPUT_OPTIONAL_UNSUPPORTED;
}
+static int stdin_plugin_dispose (input_plugin_t *this_gen ) {
+ free (this_gen);
+}
+
input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
@@ -379,6 +383,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_identifier = stdin_plugin_get_identifier;
this->input_plugin.get_autoplay_list = NULL;
this->input_plugin.get_optional_data = stdin_plugin_get_optional_data;
+ this->input_plugin.dispose = stdin_plugin_dispose;
this->input_plugin.is_branch_possible= NULL;
this->fh = -1;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index d328d4031..9cd31f7ce 100644
--- a/src/input/input_vcd.c
+++ b/src/input/input_vcd.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: input_vcd.c,v 1.38 2002/04/11 22:27:12 jcdutton Exp $
+ * $Id: input_vcd.c,v 1.39 2002/04/23 13:30:43 esnel Exp $
*
*/
@@ -1121,6 +1121,17 @@ static int vcd_plugin_get_optional_data (input_plugin_t *this_gen,
return INPUT_OPTIONAL_UNSUPPORTED;
}
+static int vcd_plugin_dispose (input_plugin_t *this_gen ) {
+ vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen;
+ int i;
+
+ for (i = 0; i < 100; i++)
+ free (this->filelist[i]);
+
+ free (this->mrls);
+ free (this);
+}
+
/*
*
*/
@@ -1166,6 +1177,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->input_plugin.get_mrl = vcd_plugin_get_mrl;
this->input_plugin.get_autoplay_list = vcd_plugin_get_autoplay_list;
this->input_plugin.get_optional_data = vcd_plugin_get_optional_data;
+ this->input_plugin.dispose = vcd_plugin_dispose;
this->input_plugin.is_branch_possible= NULL;
this->device = config->register_string(config, "input.vcd_device", CDROM,