diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-02-25 15:25:42 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-02-25 15:25:42 +0100 |
commit | d1ab9dbc5f0c35aa10ee0c67b9dc2eb6fd31dd13 (patch) | |
tree | 01b6346cf321f0c2569b2c12f43d931e5f6281a7 /dvbsubtitle.c | |
parent | e145ee45e2c2a112629814bcbba6f0e759f5132a (diff) | |
download | vdr-d1ab9dbc5f0c35aa10ee0c67b9dc2eb6fd31dd13.tar.gz vdr-d1ab9dbc5f0c35aa10ee0c67b9dc2eb6fd31dd13.tar.bz2 |
Now checking the result of all realloc() calls
Diffstat (limited to 'dvbsubtitle.c')
-rw-r--r-- | dvbsubtitle.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/dvbsubtitle.c b/dvbsubtitle.c index 39dddb59..98a45188 100644 --- a/dvbsubtitle.c +++ b/dvbsubtitle.c @@ -7,7 +7,7 @@ * Original author: Marco Schlüßler <marco@lordzodiac.de> * With some input from the "subtitle plugin" by Pekka Virtanen <pekka.virtanen@sci.fi> * - * $Id: dvbsubtitle.c 2.8 2010/10/24 12:25:45 kls Exp $ + * $Id: dvbsubtitle.c 2.9 2011/02/25 15:13:32 kls Exp $ */ #include "dvbsubtitle.h" @@ -570,12 +570,17 @@ void cDvbSubtitleAssembler::Reset(void) bool cDvbSubtitleAssembler::Realloc(int Size) { if (Size > size) { - size = max(Size, 2048); - data = (uchar *)realloc(data, size); - if (!data) { + Size = max(Size, 2048); + if (uchar *NewBuffer = (uchar *)realloc(data, Size)) { + size = Size; + data = NewBuffer; + } + else { esyslog("ERROR: can't allocate memory for subtitle assembler"); length = 0; size = 0; + free(data); + data = NULL; return false; } } |