Skip to content

Commit 5f1f4a0

Browse files
committed
malloc -> calloc
1 parent 86334e9 commit 5f1f4a0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/ota_mcxn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ MG_IRAM static bool mg_mcxn_write(void *addr, const void *buf, size_t len) {
150150

151151
// try to swap (honor dual image), otherwise just overwrite
152152
MG_IRAM static void single_bank_swap(char *p1, char *p2, size_t s, size_t ss) {
153-
char *tmp = malloc(ss);
153+
char *tmp = calloc(1, ss);
154154
// no stdlib calls here
155155
for (size_t ofs = 0; ofs < s; ofs += ss) {
156156
if (tmp != NULL)

src/ota_picosdk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static bool __no_inline_not_in_flash_func(mg_picosdk_write)(void *addr,
100100
static void __no_inline_not_in_flash_func(single_bank_swap)(char *p1, char *p2,
101101
size_t s,
102102
size_t ss) {
103-
char *tmp = malloc(ss);
103+
char *tmp = calloc(1, ss);
104104
if (tmp == NULL) return;
105105
#if PICO_RP2040
106106
uint32_t xip[256 / sizeof(uint32_t)];

0 commit comments

Comments
 (0)