Skip to content

Commit 0517663

Browse files
committed
op/aarch64: plug misc memory leaks
Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
1 parent 4f944b5 commit 0517663

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

ompi/mca/op/aarch64/op_aarch64_component.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* reserved.
55
* Copyright (c) 2019 ARM Ltd. All rights reserved.
66
* Copyright (c) 2024 NVIDIA Corporation. All rights reserved.
7+
* Copyright (c) 2024 Research Organization for Information Science
8+
* and Technology (RIST). All rights reserved.
79
*
810
* $COPYRIGHT$
911
*
@@ -165,13 +167,16 @@ ompi_op_aarch64_3buff_functions_sve[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TY
165167
static struct ompi_op_base_module_1_0_0_t *
166168
mca_op_aarch64_component_op_query(struct ompi_op_t *op, int *priority)
167169
{
168-
ompi_op_base_module_t *module = OBJ_NEW(ompi_op_base_module_t);
169170
/* Sanity check -- although the framework should never invoke the
170171
_component_op_query() on non-intrinsic MPI_Op's, we'll put a
171172
check here just to be sure. */
172173
if (0 == (OMPI_OP_FLAGS_INTRINSIC & op->o_flags)) {
173174
return NULL;
174175
}
176+
ompi_op_base_module_t *module = OBJ_NEW(ompi_op_base_module_t);
177+
if (NULL == module) {
178+
return NULL;
179+
}
175180

176181
switch (op->o_f_to_c_index) {
177182
case OMPI_OP_BASE_FORTRAN_MAX:
@@ -200,30 +205,30 @@ static struct ompi_op_base_module_1_0_0_t *
200205
}
201206
}
202207
#endif /* defined(OMPI_MCA_OP_HAVE_NEON) */
203-
if( NULL != module->opm_fns[i] ) {
204-
OBJ_RETAIN(module);
205-
}
206-
if( NULL != module->opm_3buff_fns[i] ) {
207-
OBJ_RETAIN(module);
208-
}
209208
}
210209
break;
211210
case OMPI_OP_BASE_FORTRAN_LAND:
211+
OBJ_RELEASE(module);
212212
module = NULL;
213213
break;
214214
case OMPI_OP_BASE_FORTRAN_LOR:
215+
OBJ_RELEASE(module);
215216
module = NULL;
216217
break;
217218
case OMPI_OP_BASE_FORTRAN_LXOR:
219+
OBJ_RELEASE(module);
218220
module = NULL;
219221
break;
220222
case OMPI_OP_BASE_FORTRAN_MAXLOC:
223+
OBJ_RELEASE(module);
221224
module = NULL;
222225
break;
223226
case OMPI_OP_BASE_FORTRAN_MINLOC:
227+
OBJ_RELEASE(module);
224228
module= NULL;
225229
break;
226230
default:
231+
OBJ_RELEASE(module);
227232
module= NULL;
228233
}
229234
/* If we got a module from above, we'll return it. Otherwise,

0 commit comments

Comments
 (0)