diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-02-20 17:19:54 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-02-20 17:19:54 +0100 |
commit | e85852672fdc218356e8a8565ba42ed85bed5fb4 (patch) | |
tree | 1a4e10c4515882b9d4c7095f766f6761075ce1aa /PLUGINS/src/pictures | |
parent | 698ffdc970b800a5cba32e04868a37d8c4a028fc (diff) | |
download | vdr-e85852672fdc218356e8a8565ba42ed85bed5fb4.tar.gz vdr-e85852672fdc218356e8a8565ba42ed85bed5fb4.tar.bz2 |
Fixed reallocating memory in the "pictures" plugin
Diffstat (limited to 'PLUGINS/src/pictures')
-rw-r--r-- | PLUGINS/src/pictures/HISTORY | 4 | ||||
-rw-r--r-- | PLUGINS/src/pictures/pictures.c | 4 | ||||
-rw-r--r-- | PLUGINS/src/pictures/player.c | 13 |
3 files changed, 16 insertions, 5 deletions
diff --git a/PLUGINS/src/pictures/HISTORY b/PLUGINS/src/pictures/HISTORY index d90f3c59..57290bc5 100644 --- a/PLUGINS/src/pictures/HISTORY +++ b/PLUGINS/src/pictures/HISTORY @@ -41,3 +41,7 @@ VDR Plugin 'pictures' Revision History 2010-02-28: Version 0.0.9 - Added Lithuanian language translations (thanks to Valdemaras Pipiras). + +2011-02-20: Version 0.1.0 + +- Fixed reallocating memory (reported by Paul Menzel). diff --git a/PLUGINS/src/pictures/pictures.c b/PLUGINS/src/pictures/pictures.c index 6897e239..8a890b1c 100644 --- a/PLUGINS/src/pictures/pictures.c +++ b/PLUGINS/src/pictures/pictures.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: pictures.c 2.2 2010/02/28 12:49:55 kls Exp $ + * $Id: pictures.c 2.3 2011/02/20 16:50:01 kls Exp $ */ #include <getopt.h> @@ -11,7 +11,7 @@ #include "menu.h" #include "player.h" -static const char *VERSION = "0.0.9"; +static const char *VERSION = "0.1.0"; static const char *DESCRIPTION = trNOOP("A simple picture viewer"); static const char *MAINMENUENTRY = trNOOP("Pictures"); diff --git a/PLUGINS/src/pictures/player.c b/PLUGINS/src/pictures/player.c index 8981b600..4b289ac9 100644 --- a/PLUGINS/src/pictures/player.c +++ b/PLUGINS/src/pictures/player.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: player.c 1.3 2008/02/09 12:13:10 kls Exp $ + * $Id: player.c 2.1 2011/02/20 17:15:25 kls Exp $ */ #include "player.h" @@ -66,8 +66,15 @@ void cPicturePlayer::SetPicture(const char *FileName) length = read(f, buffer, size); if (length > 0) { if (length >= size) { - size = size * 3 / 2; - buffer = (uchar *)realloc(buffer, size); + int NewSize = size * 3 / 2; + if (uchar *NewBuffer = (uchar *)realloc(buffer, NewSize)) { + buffer = NewBuffer; + size = NewSize; + } + else { + LOG_ERROR_STR("out of memory"); + break; + } lseek(f, 0, SEEK_SET); continue; } |