@@ -1296,6 +1296,10 @@ ucc_status_t ucc_mem_map_export(ucc_context_h context,
1296
1296
}
1297
1297
total_pack_size += local_memh -> tl_h [i ].packed_size ;
1298
1298
}
1299
+ if (packed_tls == 0 ) {
1300
+ ucc_debug ("No TLs available for packing" );
1301
+ return UCC_OK ;
1302
+ }
1299
1303
1300
1304
/* allocate exported memh, copy items over */
1301
1305
exported_memh = (ucc_mem_map_memh_t * )ucc_calloc (
@@ -1315,13 +1319,14 @@ ucc_status_t ucc_mem_map_export(ucc_context_h context,
1315
1319
if (!exported_memh -> tl_h ) {
1316
1320
ucc_error ("failed to allocate handle for exported buffers' tl handles" );
1317
1321
status = UCC_ERR_NO_MEMORY ;
1322
+ ucc_free (exported_memh );
1318
1323
goto failed_pack ;
1319
1324
}
1320
1325
1321
1326
for (i = 0 , offset = 0 , tls = 0 ; i < ctx -> n_tl_ctx ; i ++ ) {
1322
1327
if (local_memh -> tl_h [i ].packed_size ) {
1323
- strcpy (PTR_OFFSET (exported_memh -> pack_buffer , offset ),
1324
- local_memh -> tl_h [i ].tl_name );
1328
+ strncpy (PTR_OFFSET (exported_memh -> pack_buffer , offset ),
1329
+ local_memh -> tl_h [i ].tl_name , UCC_MEM_MAP_TL_NAME_LEN );
1325
1330
offset += UCC_MEM_MAP_TL_NAME_LEN ;
1326
1331
memcpy (PTR_OFFSET (exported_memh -> pack_buffer , offset ),
1327
1332
& local_memh -> tl_h [i ].packed_size , sizeof (size_t ));
0 commit comments