Skip to content

Commit

Permalink
Merge pull request #12615 from ggouaillardet/topic/op_memory_leaks
Browse files Browse the repository at this point in the history
op: plug memory leaks
  • Loading branch information
bosilca authored Jun 20, 2024
2 parents 9f58fd2 + 0517663 commit 5e45a9d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
19 changes: 12 additions & 7 deletions ompi/mca/op/aarch64/op_aarch64_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* reserved.
* Copyright (c) 2019 ARM Ltd. All rights reserved.
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2024 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* $COPYRIGHT$
*
Expand Down Expand Up @@ -165,13 +167,16 @@ ompi_op_aarch64_3buff_functions_sve[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TY
static struct ompi_op_base_module_1_0_0_t *
mca_op_aarch64_component_op_query(struct ompi_op_t *op, int *priority)
{
ompi_op_base_module_t *module = OBJ_NEW(ompi_op_base_module_t);
/* Sanity check -- although the framework should never invoke the
_component_op_query() on non-intrinsic MPI_Op's, we'll put a
check here just to be sure. */
if (0 == (OMPI_OP_FLAGS_INTRINSIC & op->o_flags)) {
return NULL;
}
ompi_op_base_module_t *module = OBJ_NEW(ompi_op_base_module_t);
if (NULL == module) {
return NULL;
}

switch (op->o_f_to_c_index) {
case OMPI_OP_BASE_FORTRAN_MAX:
Expand Down Expand Up @@ -200,30 +205,30 @@ static struct ompi_op_base_module_1_0_0_t *
}
}
#endif /* defined(OMPI_MCA_OP_HAVE_NEON) */
if( NULL != module->opm_fns[i] ) {
OBJ_RETAIN(module);
}
if( NULL != module->opm_3buff_fns[i] ) {
OBJ_RETAIN(module);
}
}
break;
case OMPI_OP_BASE_FORTRAN_LAND:
OBJ_RELEASE(module);
module = NULL;
break;
case OMPI_OP_BASE_FORTRAN_LOR:
OBJ_RELEASE(module);
module = NULL;
break;
case OMPI_OP_BASE_FORTRAN_LXOR:
OBJ_RELEASE(module);
module = NULL;
break;
case OMPI_OP_BASE_FORTRAN_MAXLOC:
OBJ_RELEASE(module);
module = NULL;
break;
case OMPI_OP_BASE_FORTRAN_MINLOC:
OBJ_RELEASE(module);
module= NULL;
break;
default:
OBJ_RELEASE(module);
module= NULL;
}
/* If we got a module from above, we'll return it. Otherwise,
Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/op/base/op_base_op_select.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2020 Research Organization for Information Science
* Copyright (c) 2020-2024 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -163,7 +163,7 @@ int ompi_op_base_op_select(ompi_op_t *op)

/* 3-buffer variants */
if (NULL != avail->ao_module->opm_3buff_fns[i]) {
OBJ_RELEASE(op->o_func.intrinsic.modules[i]);
OBJ_RELEASE(op->o_3buff_intrinsic.modules[i]);
op->o_3buff_intrinsic.fns[i] =
avail->ao_module->opm_3buff_fns[i];
op->o_3buff_intrinsic.modules[i] = avail->ao_module;
Expand Down

0 comments on commit 5e45a9d

Please sign in to comment.