1
1
Fix CID 1324726 (#1 of 1): Free of address-of expression (BAD_FREE):

Indeed, if a lock conflicts with the lock_all we will end up trying to
free an invalid pointer.

Fix CID 1328826 (#1 of 1): Dereference after null check (FORWARD_NULL):

This was intentional but it would be a good idea to check for
module->comm being non_NULL to be safe. Also cleaned out some checks
for NULL before free().

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
Nathan Hjelm 2016-03-18 09:11:48 -06:00
родитель 013aec894b
Коммит 2ed4501490
2 изменённых файлов: 8 добавлений и 13 удалений

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

@ -320,7 +320,9 @@ static int ompi_osc_pt2pt_lock_internal (int lock_type, int target, int assert,
/* check for conflicting lock */
if (ompi_osc_pt2pt_module_lock_find (module, target, NULL)) {
ompi_osc_pt2pt_sync_return (lock);
if (&module->all_sync != lock) {
ompi_osc_pt2pt_sync_return (lock);
}
OPAL_THREAD_UNLOCK(&module->lock);
return OMPI_ERR_RMA_CONFLICT;
}

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

@ -8,7 +8,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved.
* $COPYRIGHT$
@ -103,18 +103,12 @@ int ompi_osc_rdma_free(ompi_win_t *win)
}
OBJ_DESTRUCT(&module->peer_hash);
} else {
} else if (NULL != module->comm) {
for (int i = 0 ; i < ompi_comm_rank (module->comm) ; ++i) {
if (NULL != module->peer_array[i]) {
OBJ_RELEASE(module->peer_array[i]);
}
}
free (module->peer_array);
}
if (NULL != module->outstanding_lock_array) {
free (module->outstanding_lock_array);
}
if (module->local_leaders && MPI_COMM_NULL != module->local_leaders) {
@ -129,15 +123,14 @@ int ompi_osc_rdma_free(ompi_win_t *win)
ompi_comm_free (&module->comm);
}
if (NULL != module->free_after) {
free(module->free_after);
}
if (module->segment_base) {
opal_shmem_segment_detach (&module->seg_ds);
module->segment_base = NULL;
}
free (module->peer_array);
free (module->outstanding_lock_array);
free (module->free_after);
free (module);
return OMPI_SUCCESS;