Skip to content

Commit c85d4e1

Browse files
authored
Merge pull request #1129 from rtwfroody/calloc
target/riscv: Fix calloc calls.
2 parents c455b60 + 77bffed commit c85d4e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/target/riscv/riscv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3759,7 +3759,7 @@ static int riscv_openocd_step_impl(struct target *target, int current,
37593759
return ERROR_FAIL;
37603760

37613761
RISCV_INFO(r);
3762-
bool *wps_to_enable = calloc(sizeof(*wps_to_enable), r->trigger_count);
3762+
bool *wps_to_enable = calloc(r->trigger_count, sizeof(*wps_to_enable));
37633763
if (disable_watchpoints(target, wps_to_enable) != ERROR_OK) {
37643764
LOG_TARGET_ERROR(target, "Failed to temporarily disable "
37653765
"watchpoints before single-step.");
@@ -5790,7 +5790,7 @@ int riscv_enumerate_triggers(struct target *target)
57905790
r->trigger_count = t;
57915791
LOG_TARGET_INFO(target, "Found %d triggers", r->trigger_count);
57925792
free(r->reserved_triggers);
5793-
r->reserved_triggers = calloc(sizeof(*r->reserved_triggers), t);
5793+
r->reserved_triggers = calloc(t, sizeof(*r->reserved_triggers));
57945794
create_wp_trigger_cache(target);
57955795
return ERROR_OK;
57965796
}

0 commit comments

Comments
 (0)