Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/target/cortexar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1864,8 +1864,9 @@ static const char *cortexar_target_description(target_s *const target)
const size_t description_length =
cortexar_build_target_description(NULL, 0, target->target_options & TOPT_FLAVOUR_FLOAT) + 1U;
char *const description = malloc(description_length);
if (description)
(void)cortexar_build_target_description(
description, description_length, target->target_options & TOPT_FLAVOUR_FLOAT);
if (!description) /* malloc failed: heap exhaustion */
DEBUG_ERROR("malloc: failed in %s\n", __func__);
else
cortexar_build_target_description(description, description_length, target->target_options & TOPT_FLAVOUR_FLOAT);
return description;
}
4 changes: 3 additions & 1 deletion src/target/cortexm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,9 @@ static const char *cortexm_target_description(target_s *const target)
{
const size_t description_length = cortexm_build_target_description(NULL, 0, target->target_options) + 1U;
char *const description = malloc(description_length);
if (description)
if (!description) /* malloc failed: heap exhaustion */
DEBUG_ERROR("malloc: failed in %s\n", __func__);
else
cortexm_build_target_description(description, description_length, target->target_options);
return description;
}
6 changes: 4 additions & 2 deletions src/target/riscv_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,9 @@ static const char *riscv_target_description(target_s *const target)
const size_t description_length =
riscv_build_target_description(NULL, 0, hart->address_width, hart->extensions) + 1U;
char *const description = malloc(description_length);
if (description)
(void)riscv_build_target_description(description, description_length, hart->address_width, hart->extensions);
if (!description) /* malloc failed: heap exhaustion */
DEBUG_ERROR("malloc: failed in %s\n", __func__);
else
riscv_build_target_description(description, description_length, hart->address_width, hart->extensions);
return description;
}
Loading