summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2004-05-21 19:54:42 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2004-05-21 19:54:42 +0000
commit8b475790cbeeb1cea631c9fac276be8b32370f1a (patch)
treee4c1eacd7560e2d32a62543abda021cf7b060534
parentb73e0e6315a0a3594c50759e070f042862ca4308 (diff)
downloadxine-lib-8b475790cbeeb1cea631c9fac276be8b32370f1a.tar.gz
xine-lib-8b475790cbeeb1cea631c9fac276be8b32370f1a.tar.bz2
double-free fix for yuv decoder by Barry Scott
CVS patchset: 6576 CVS date: 2004/05/21 19:54:42
-rw-r--r--ChangeLog2
-rw-r--r--src/libxinevdec/yuv.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 73ad71310..cc11c7580 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
* add support for upmixing. Currently only stereo -> Surround 5.1
* Software decode for DTS audio updated for Surround 5.1 output.
* fixed compilation of libmad on AMD64
+ * fixed double-free in the yuv decoder (fixes crashes when switching
+ away from v4l:/ MRLs)
xine-lib (1-rc4a)
* audio out now uses a more user friendly "Speaker arrangement" config item;
diff --git a/src/libxinevdec/yuv.c b/src/libxinevdec/yuv.c
index 5847bb90b..aacec69a3 100644
--- a/src/libxinevdec/yuv.c
+++ b/src/libxinevdec/yuv.c
@@ -21,7 +21,7 @@
* Actually, this decoder just reorganizes chunks of raw YUV data in such
* a way that xine can display them.
*
- * $Id: yuv.c,v 1.32 2004/03/07 22:45:23 jstembridge Exp $
+ * $Id: yuv.c,v 1.33 2004/05/21 19:54:42 mroi Exp $
*/
#include <stdio.h>
@@ -94,9 +94,6 @@ static void yuv_decode_data (video_decoder_t *this_gen,
if (buf->decoder_flags & BUF_FLAG_STDHEADER) { /* need to initialize */
this->stream->video_out->open (this->stream->video_out, this->stream);
- if(this->buf)
- free(this->buf);
-
bih = (xine_bmiheader *) buf->content;
this->width = (bih->biWidth + 3) & ~0x03;
this->height = (bih->biHeight + 3) & ~0x03;
@@ -109,8 +106,11 @@ static void yuv_decode_data (video_decoder_t *this_gen,
this->progressive = buf->decoder_info[3];
this->top_field_first = buf->decoder_info[4];
- if (this->buf)
+ if (this->buf) {
free (this->buf);
+ this->buf = NULL;
+ }
+
this->bufsize = VIDEOBUFSIZE;
this->buf = malloc(this->bufsize);
this->size = 0;