summaryrefslogtreecommitdiff
path: root/themes.c
diff options
context:
space:
mode:
Diffstat (limited to 'themes.c')
-rw-r--r--themes.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/themes.c b/themes.c
index e6ee87e3..034ec0b9 100644
--- a/themes.c
+++ b/themes.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: themes.c 1.8 2008/02/10 16:25:00 kls Exp $
+ * $Id: themes.c 2.1 2011/02/25 14:45:18 kls Exp $
*/
#include "themes.h"
@@ -248,12 +248,30 @@ bool cThemes::Load(const char *SkinName)
cString FileName = AddDirectory(themesDirectory, e->d_name);
cTheme Theme;
if (Theme.Load(*FileName, true)) {
- names = (char **)realloc(names, (numThemes + 1) * sizeof(char *));
- names[numThemes] = strdup(Theme.Name());
- fileNames = (char **)realloc(fileNames, (numThemes + 1) * sizeof(char *));
- fileNames[numThemes] = strdup(*FileName);
- descriptions = (char **)realloc(descriptions, (numThemes + 1) * sizeof(char *));
- descriptions[numThemes] = strdup(Theme.Description());
+ if (char **NewBuffer = (char **)realloc(names, (numThemes + 1) * sizeof(char *))) {
+ names = NewBuffer;
+ names[numThemes] = strdup(Theme.Name());
+ }
+ else {
+ esyslog("ERROR: out of memory");
+ break;
+ }
+ if (char **NewBuffer = (char **)realloc(fileNames, (numThemes + 1) * sizeof(char *))) {
+ fileNames = NewBuffer;
+ fileNames[numThemes] = strdup(*FileName);
+ }
+ else {
+ esyslog("ERROR: out of memory");
+ break;
+ }
+ if (char **NewBuffer = (char **)realloc(descriptions, (numThemes + 1) * sizeof(char *))) {
+ descriptions = NewBuffer;
+ descriptions[numThemes] = strdup(Theme.Description());
+ }
+ else {
+ esyslog("ERROR: out of memory");
+ break;
+ }
numThemes++;
}
}