From 8b475790cbeeb1cea631c9fac276be8b32370f1a Mon Sep 17 00:00:00 2001 From: Michael Roitzsch Date: Fri, 21 May 2004 19:54:42 +0000 Subject: double-free fix for yuv decoder by Barry Scott CVS patchset: 6576 CVS date: 2004/05/21 19:54:42 --- ChangeLog | 2 ++ src/libxinevdec/yuv.c | 10 +++++----- 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 @@ -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; -- cgit v1.2.3