diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 88f60ce2..67610875 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -677,6 +677,7 @@ Oliver Endriss for reporting broken index generation in TS recordings after a buffer overflow for fixing the way the OSD size is determined on full featured DVB cards for his input on calculating the Aspect factor in GetOsdSize() + for suggesting a better way of handling calls to realloc() Reinhard Walter Buchner for adding some satellites to 'sources.conf' diff --git a/HISTORY b/HISTORY index db7ae384..79ec7a95 100644 --- a/HISTORY +++ b/HISTORY @@ -6537,3 +6537,4 @@ Video Disk Recorder Revision History - Added Serbian language texts (thanks to Milan Cvijanovic). - Fixed reallocating memory in the "pictures" plugin (reported by Paul Menzel, with input from Oliver Endriss). +- Fixed reallocating memory in cTsToPes::PutTs() (suggested by Oliver Endriss). diff --git a/remux.c b/remux.c index b30b12ca..fd47d3c3 100644 --- a/remux.c +++ b/remux.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remux.c 2.48 2010/11/01 12:29:17 kls Exp $ + * $Id: remux.c 2.49 2011/02/20 17:27:47 kls Exp $ */ #include "remux.h" @@ -666,9 +666,12 @@ void cTsToPes::PutTs(const uchar *Data, int Length) return; // skip everything before the first payload start Length = TsGetPayload(&Data); if (length + Length > size) { - size = max(KILOBYTE(2), length + Length); - data = (uchar *)realloc(data, size); - if (!data) { + int NewSize = max(KILOBYTE(2), length + Length); + if (uchar *NewData = (uchar *)realloc(data, NewSize)) { + data = NewData; + size = NewSize; + } + else { Reset(); return; }