summaryrefslogtreecommitdiff
path: root/svdrp.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 /svdrp.c
parente145ee45e2c2a112629814bcbba6f0e759f5132a (diff)
downloadvdr-d1ab9dbc5f0c35aa10ee0c67b9dc2eb6fd31dd13.tar.gz
vdr-d1ab9dbc5f0c35aa10ee0c67b9dc2eb6fd31dd13.tar.bz2
Now checking the result of all realloc() calls
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/svdrp.c b/svdrp.c
index cb9a9351..fe3bcc7c 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 2.8 2010/01/17 12:23:31 kls Exp $
+ * $Id: svdrp.c 2.9 2011/02/25 14:38:45 kls Exp $
*/
#include "svdrp.h"
@@ -1664,8 +1664,16 @@ bool cSVDRP::Process(void)
}
else {
if (numChars >= length - 1) {
- length += BUFSIZ;
- cmdLine = (char *)realloc(cmdLine, length);
+ int NewLength = length + BUFSIZ;
+ if (char *NewBuffer = (char *)realloc(cmdLine, NewLength)) {
+ length = NewLength;
+ cmdLine = NewBuffer;
+ }
+ else {
+ esyslog("ERROR: out of memory");
+ Close();
+ break;
+ }
}
cmdLine[numChars++] = c;
cmdLine[numChars] = 0;