diff --git a/ompi/datatype/dt_args.c b/ompi/datatype/dt_args.c index 9822365e2a..d4c1fccbfe 100644 --- a/ompi/datatype/dt_args.c +++ b/ompi/datatype/dt_args.c @@ -363,7 +363,11 @@ int ompi_ddt_get_pack_description( ompi_datatype_t* datatype, void* recursive_buffer; if( NULL == datatype->packed_description ) { - datatype->packed_description = malloc( args->total_pack_size ); + if( datatype->flags & DT_FLAG_PREDEFINED ) { + datatype->packed_description = malloc( 2 * sizeof(int) ); + } else { + datatype->packed_description = malloc( args->total_pack_size ); + } recursive_buffer = datatype->packed_description; __ompi_ddt_pack_description( datatype, &recursive_buffer, &next_index ); } diff --git a/ompi/datatype/dt_module.c b/ompi/datatype/dt_module.c index 8aa69a201a..7c180a8f7c 100644 --- a/ompi/datatype/dt_module.c +++ b/ompi/datatype/dt_module.c @@ -399,9 +399,6 @@ int32_t ompi_ddt_init( void ) datatype->desc.length = 1; datatype->desc.used = 1; datatype->btypes[i] = 1; - datatype->packed_description = malloc(2 * sizeof(int) ); - ((int*)(datatype->packed_description))[0] = MPI_COMBINER_DUP; - ((int*)(datatype->packed_description))[1] = i; } /* Create the f2c translation table */