Skip to content

Commit c8ec986

Browse files
author
ferrol aderholdt
committed
REVIEW: fix clang-tidy
1 parent a1ffa62 commit c8ec986

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/core/ucc_context.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,10 @@ ucc_status_t ucc_mem_map_export(ucc_context_h context,
12961296
}
12971297
total_pack_size += local_memh->tl_h[i].packed_size;
12981298
}
1299+
if (packed_tls == 0) {
1300+
ucc_debug("No TLs available for packing");
1301+
return UCC_OK;
1302+
}
12991303

13001304
/* allocate exported memh, copy items over */
13011305
exported_memh = (ucc_mem_map_memh_t *)ucc_calloc(
@@ -1315,13 +1319,14 @@ ucc_status_t ucc_mem_map_export(ucc_context_h context,
13151319
if (!exported_memh->tl_h) {
13161320
ucc_error("failed to allocate handle for exported buffers' tl handles");
13171321
status = UCC_ERR_NO_MEMORY;
1322+
ucc_free(exported_memh);
13181323
goto failed_pack;
13191324
}
13201325

13211326
for (i = 0, offset = 0, tls = 0; i < ctx->n_tl_ctx; i++) {
13221327
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);
13251330
offset += UCC_MEM_MAP_TL_NAME_LEN;
13261331
memcpy(PTR_OFFSET(exported_memh->pack_buffer, offset),
13271332
&local_memh->tl_h[i].packed_size, sizeof(size_t));

0 commit comments

Comments
 (0)