Skip to content

Commit

Permalink
Merge pull request #1129 from rtwfroody/calloc
Browse files Browse the repository at this point in the history
target/riscv: Fix calloc calls.
  • Loading branch information
en-sc authored Sep 10, 2024
2 parents c455b60 + 77bffed commit c85d4e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/target/riscv/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3759,7 +3759,7 @@ static int riscv_openocd_step_impl(struct target *target, int current,
return ERROR_FAIL;

RISCV_INFO(r);
bool *wps_to_enable = calloc(sizeof(*wps_to_enable), r->trigger_count);
bool *wps_to_enable = calloc(r->trigger_count, sizeof(*wps_to_enable));
if (disable_watchpoints(target, wps_to_enable) != ERROR_OK) {
LOG_TARGET_ERROR(target, "Failed to temporarily disable "
"watchpoints before single-step.");
Expand Down Expand Up @@ -5790,7 +5790,7 @@ int riscv_enumerate_triggers(struct target *target)
r->trigger_count = t;
LOG_TARGET_INFO(target, "Found %d triggers", r->trigger_count);
free(r->reserved_triggers);
r->reserved_triggers = calloc(sizeof(*r->reserved_triggers), t);
r->reserved_triggers = calloc(t, sizeof(*r->reserved_triggers));
create_wp_trigger_cache(target);
return ERROR_OK;
}
Expand Down

0 comments on commit c85d4e1

Please sign in to comment.