summaryrefslogtreecommitdiff
path: root/src/main/Banner.c
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-07-20 12:53:17 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-07-20 12:53:17 +0000
commit128474e2c3d87ac4c41465ed207e7e86017aca7f (patch)
tree3bd0846e47ac343d884695d3bae468f5f90ccbe5 /src/main/Banner.c
parentdc26035b77e21a291cdd4c87cb6c79014b273675 (diff)
Fixed a memory allocation bug. Banners should work now.
Tom and Gab git-svn-id: http://svn.cactuscode.org/flesh/trunk@745 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/Banner.c')
-rw-r--r--src/main/Banner.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main/Banner.c b/src/main/Banner.c
index 8310224e..66d5193a 100644
--- a/src/main/Banner.c
+++ b/src/main/Banner.c
@@ -37,14 +37,28 @@ void CCTKi_PrintBanners(void);
void CCTK_RegisterBanner(const char *string)
{
+ const char **temp = NULL;
number_banners++;
if (number_banners == 1)
+ {
banner_strings = (const char **)malloc( number_banners*sizeof(const char *));
+ temp = banner_strings;
+ }
else
- realloc( banner_strings, number_banners*sizeof(const char *));
+ {
+ temp = realloc( banner_strings, number_banners*sizeof(const char *));
- banner_strings[number_banners-1] = string;
+ if(temp)
+ {
+ banner_strings = temp;
+ }
+ }
+
+ if(temp)
+ {
+ banner_strings[number_banners-1] = string;
+ }
}
@@ -78,8 +92,7 @@ void CCTKi_PrintBanners(void)
if (banner_strings[i])
{
printf("-------------------------------------------------------------------------------------\n");
- printf("Banner\n");
- /* printf("%s\n",banner_strings[i]); */
+ printf("%s\n",banner_strings[i]);
printf("-------------------------------------------------------------------------------------\n");
}
}