1
1

If MPI_ALLOC_MEM is invoked with a 0 sized request, return NULL. If

MPI_FREE_MEM is invoked with NULL, return success.

Fixes trac:1101.

This commit was SVN r15593.

The following Trac tickets were found above:
  Ticket 1101 --> https://svn.open-mpi.org/trac/ompi/ticket/1101
Этот коммит содержится в:
Jeff Squyres 2007-07-25 01:00:30 +00:00
родитель e6345aeac6
Коммит e80b7e9dde
2 изменённых файлов: 22 добавлений и 8 удалений

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -52,6 +53,19 @@ int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr)
}
}
/* Per these threads:
http://www.open-mpi.org/community/lists/devel/2007/07/1977.php
http://www.open-mpi.org/community/lists/devel/2007/07/1979.php
If you call MPI_ALLOC_MEM with a size of 0, you get NULL
back .*/
if (0 == size) {
*((void **) baseptr) = NULL;
printf("0 size mem_alloc\n");
return MPI_SUCCESS;
}
*((void **) baseptr) = mca_mpool_base_alloc((size_t) size, info);
if (NULL == *((void **) baseptr)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM,

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -39,15 +40,14 @@ int MPI_Free_mem(void *baseptr)
{
OPAL_CR_TEST_CHECKPOINT_READY();
if (MPI_PARAM_CHECK) {
if (NULL == baseptr) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
FUNC_NAME);
}
}
/* Per these threads:
if(OMPI_SUCCESS != mca_mpool_base_free(baseptr))
{
http://www.open-mpi.org/community/lists/devel/2007/07/1977.php
http://www.open-mpi.org/community/lists/devel/2007/07/1979.php
If you call MPI_ALLOC_MEM with a size of 0, you get NULL
back. So don't consider a NULL==baseptr an error. */
if (NULL != baseptr && OMPI_SUCCESS != mca_mpool_base_free(baseptr)) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_NO_MEM, FUNC_NAME);
}