aboutsummaryrefslogtreecommitdiff
path: root/src/Storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Storage.c')
-rw-r--r--src/Storage.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Storage.c b/src/Storage.c
index 5c9f1cb..c73e42f 100644
--- a/src/Storage.c
+++ b/src/Storage.c
@@ -613,7 +613,7 @@ static int PUGH_EnableGArrayGroupStorage (pGH *pughGH,
GA->padddata = NULL;
}
- if (GA->extras->npoints * GA->varsize * GA->vector_size <= 0)
+ if ((size_t) GA->extras->npoints * GA->varsize * GA->vector_size <= 0)
{
/* only warn if the global array size is also zero */
for (i = 0, global_size = 1; i < GA->extras->dim; i++)
@@ -631,15 +631,22 @@ static int PUGH_EnableGArrayGroupStorage (pGH *pughGH,
else if (! my_padding_active)
{
/* Easy case. */
- GA->data = malloc (GA->extras->npoints * GA->varsize * GA->vector_size);
+ GA->data = malloc ((size_t) GA->extras->npoints * GA->varsize
+ * GA->vector_size);
GA->padddata = GA->data;
}
else
{
/* Use the Cactus Cache alignment function */
GA->data = Util_CacheMalloc (GA->arrayid,
- GA->extras->npoints * GA->varsize * GA->vector_size,
- &GA->padddata);
+ (size_t) GA->extras->npoints * GA->varsize
+ * GA->vector_size, &GA->padddata);
+ }
+ if (!GA->data)
+ {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "Error allocating memory "
+ "block of size %.0f",
+ (double) GA->extras->npoints * GA->varsize * GA->vector_size);
}
GA->npoints = GA->extras->npoints;
#ifdef DEBUG_PUGH