summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2011-02-25 15:25:42 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2011-02-25 15:25:42 +0100
commitd1ab9dbc5f0c35aa10ee0c67b9dc2eb6fd31dd13 (patch)
tree01b6346cf321f0c2569b2c12f43d931e5f6281a7 /menu.c
parente145ee45e2c2a112629814bcbba6f0e759f5132a (diff)
downloadvdr-d1ab9dbc5f0c35aa10ee0c67b9dc2eb6fd31dd13.tar.gz
vdr-d1ab9dbc5f0c35aa10ee0c67b9dc2eb6fd31dd13.tar.bz2
Now checking the result of all realloc() calls
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/menu.c b/menu.c
index 8b31de52..a371d820 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 2.25 2010/12/12 13:36:20 kls Exp $
+ * $Id: menu.c 2.26 2011/02/25 14:24:32 kls Exp $
*/
#include "menu.h"
@@ -1860,8 +1860,14 @@ eOSState cMenuCommands::Execute(void)
int l = 0;
int c;
while ((c = fgetc(p)) != EOF) {
- if (l % 20 == 0)
- result = (char *)realloc(result, l + 21);
+ if (l % 20 == 0) {
+ if (char *NewBuffer = (char *)realloc(result, l + 21))
+ result = NewBuffer;
+ else {
+ esyslog("ERROR: out of memory");
+ break;
+ }
+ }
result[l++] = char(c);
}
if (result)