Skip to content

Commit 712c7e1

Browse files
committed
dataloop: Use calloc to allocate dataloop structure
Dataloop structures may be flattened and sent to other processes e.g. in RMA communication. Use calloc to zero-init the structure and avoid valgrind warnings for accessing uninitialized bytes during communication.
1 parent c820cd6 commit 712c7e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mpi/datatype/typerep/dataloop/dataloop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ void MPII_Dataloop_alloc_and_copy(int kind,
397397
new_loop_sz += loop_sz + off_sz + blk_sz + ptr_sz + extent_sz + old_loop_sz;
398398

399399
/* allocate space */
400-
new_loop = (MPII_Dataloop *) MPL_malloc(new_loop_sz, MPL_MEM_DATATYPE);
400+
new_loop = (MPII_Dataloop *) MPL_calloc(1, new_loop_sz, MPL_MEM_DATATYPE);
401401
if (new_loop == NULL) {
402402
*new_loop_p = NULL;
403403
return;

0 commit comments

Comments
 (0)