diff options
author | eschnett <eschnett@d0051148-8e13-4bef-be1d-f6c572c85f9f> | 2014-04-30 12:48:27 +0000 |
---|---|---|
committer | eschnett <eschnett@d0051148-8e13-4bef-be1d-f6c572c85f9f> | 2014-04-30 12:48:27 +0000 |
commit | 8c80fa8851373e7dd978a3bf953c97ef69b42002 (patch) | |
tree | 5b3ea286ebd79ab57628942d6aa0790a45e3cd5f | |
parent | 2f19d12b18cc947c674a87856affd09dd816a9ab (diff) |
Correct error check for mallocsvn
git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/TimerReport/trunk@61 d0051148-8e13-4bef-be1d-f6c572c85f9f
-rw-r--r-- | src/Output.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Output.c b/src/Output.c index 3efd95b..7a6f21e 100644 --- a/src/Output.c +++ b/src/Output.c @@ -684,9 +684,9 @@ static int CollectTimerInfo(cGH const *restrict const cctkGH, } /* Determine local timer names and their values */ - timername_t *my_timernames = - malloc(my_ntimers * sizeof(*my_timernames)); /* these arrays can be too large for the stack */ - assert(my_timernames); + /* (these arrays can be too large for the stack_ */ + timername_t *my_timernames = malloc(my_ntimers * sizeof *my_timernames); + assert(my_ntimers==0 || my_timernames); for (int n=0; n<my_ntimers; ++n) { const char *name = CCTK_TimerName(n); @@ -720,9 +720,9 @@ static int CollectTimerInfo(cGH const *restrict const cctkGH, } /* Gather timer names and values from each process */ - timername_t *all_timernames = - malloc(total_ntimers * sizeof(*all_timernames)); /* these arrays can likely be too large for the stack */ - assert(all_timernames); + /* (these arrays can likely be too large for the stack) */ + timername_t *all_timernames = malloc(total_ntimers * sizeof *all_timernames); + assert(total_ntimers==0 || all_timernames); double all_timervalues[total_ntimers]; int name_displacements[nprocs], value_displacements[nprocs]; int name_counts[nprocs]; @@ -837,7 +837,7 @@ static int CollectTimerInfo(cGH const *restrict const cctkGH, timers->secs_max[n] = maxval; } } - + free(all_timernames); free(my_timernames); |