[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1rc1-19-ga4c8f44

mysql vizuser noreply at mpich.org
Thu Nov 14 16:00:15 CST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  a4c8f44235de1923ceb0cf113b17fd3bc9d4e33a (commit)
      from  9590e3700c32173721861697840b4b0ee689e5d4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/a4c8f44235de1923ceb0cf113b17fd3bc9d4e33a

commit a4c8f44235de1923ceb0cf113b17fd3bc9d4e33a
Author: Jeff Hammond <jeff.science at gmail.com>
Date:   Sat Nov 9 14:33:01 2013 -0600

    check for size!=0 when erroring out on new==NULL
    
    per http://stackoverflow.com/questions/2132273/what-does-malloc0-return,
    malloc(0) may or may not return NULL.  it is implementation defined in
    C99.  therefore, it is incorrect to throw an OoM error on !new when
    size=0.
    
    closes #1947
    
    Signed-off-by: Rob Latham <robl at mcs.anl.gov>

diff --git a/src/mpi/romio/adio/common/malloc.c b/src/mpi/romio/adio/common/malloc.c
index 4541a35..73c5a70 100644
--- a/src/mpi/romio/adio/common/malloc.c
+++ b/src/mpi/romio/adio/common/malloc.c
@@ -50,7 +50,7 @@ void *ADIOI_Malloc_fn(size_t size, int lineno, const char *fname)
     new = (void *) malloc(size);
 #endif
 #endif
-    if (!new) {
+    if (!new && size) {
 	FPRINTF(stderr, "Out of memory in file %s, line %d\n", fname, lineno);
 	MPI_Abort(MPI_COMM_WORLD, 1);
     }
@@ -68,7 +68,7 @@ void *ADIOI_Calloc_fn(size_t nelem, size_t elsize, int lineno, const char *fname
 #else
     new = (void *) calloc(nelem, elsize);
 #endif
-    if (!new) {
+    if (!new && nelem) {
 	FPRINTF(stderr, "Out of memory in file %s, line %d\n", fname, lineno);
 	MPI_Abort(MPI_COMM_WORLD, 1);
     }
@@ -86,7 +86,7 @@ void *ADIOI_Realloc_fn(void *ptr, size_t size, int lineno, const char *fname)
 #else
     new = (void *) realloc(ptr, size);
 #endif
-    if (!new) {
+    if (!new && size) {
 	FPRINTF(stderr, "realloc failed in file %s, line %d\n", fname, lineno);
 	MPI_Abort(MPI_COMM_WORLD, 1);
     }

-----------------------------------------------------------------------

Summary of changes:
 src/mpi/romio/adio/common/malloc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list