summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2008-06-20 11:36:02 +0000
committerphintuka <phintuka>2008-06-20 11:36:02 +0000
commita98178d4ac470fe525c530f8c107cfec4e4c4f24 (patch)
treeef0f36cbc84025c23bd43403954a2c18609911b7
parent769e8f55540d8c55a09ec574719121e1140751c6 (diff)
downloadxineliboutput-a98178d4ac470fe525c530f8c107cfec4e4c4f24.tar.gz
xineliboutput-a98178d4ac470fe525c530f8c107cfec4e4c4f24.tar.bz2
Do not dispose HD buffer in get_buf_element.
This should fix "double free or corruption" when switching from HD channel to SD channel. (Reported by Goga777)
-rw-r--r--xine_input_vdr.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/xine_input_vdr.c b/xine_input_vdr.c
index 4a9f2efd..9f878cf1 100644
--- a/xine_input_vdr.c
+++ b/xine_input_vdr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_input_vdr.c,v 1.154 2008-06-19 13:30:21 phintuka Exp $
+ * $Id: xine_input_vdr.c,v 1.155 2008-06-20 11:36:02 phintuka Exp $
*
*/
@@ -1454,22 +1454,8 @@ static buf_element_t *get_buf_element(vdr_input_plugin_t *this, int size, int fo
buf_element_t *buf = NULL;
/* HD buffer */
- if(this->hd_stream) {
- if(!this->hd_buffer)
- this->hd_buffer = fifo_buffer_new(this->stream, HD_BUF_NUM_BUFS, HD_BUF_ELEM_SIZE);
-
- if(size <= HD_BUF_ELEM_SIZE && this->hd_buffer && this->hd_stream)
- buf = this->hd_buffer->buffer_pool_try_alloc(this->hd_buffer);
- } else {
- if(this->hd_buffer) {
- LOGMSG("hd_buffer still exists ...");
- if(this->hd_buffer->num_free(this->hd_buffer) == this->hd_buffer->buffer_pool_capacity) {
- LOGMSG("disposing hd_buffer ...");
- this->hd_buffer->dispose(this->hd_buffer);
- this->hd_buffer = NULL;
- }
- }
- }
+ if(this->hd_stream && size <= HD_BUF_ELEM_SIZE)
+ buf = this->hd_buffer->buffer_pool_try_alloc(this->hd_buffer);
/* limit max. buffered data */
if(!force && !buf) {
@@ -3520,7 +3506,13 @@ static int vdr_plugin_parse_control(vdr_input_plugin_if_t *this_if, const char *
} else if(!strncasecmp(cmd, "HDMODE ", 7)) {
if(1 == sscanf(cmd, "HDMODE %d", &tmp32)) {
pthread_mutex_lock(&this->lock);
- this->hd_stream = tmp32 ? 1 : 0;
+ if(tmp32) {
+ if(!this->hd_buffer)
+ this->hd_buffer = fifo_buffer_new(this->stream, HD_BUF_NUM_BUFS, HD_BUF_ELEM_SIZE);
+ this->hd_stream = 1;
+ } else {
+ this->hd_stream = 0;
+ }
pthread_mutex_unlock(&this->lock);
}