From e0636718163c77bbde211b66a6de85a006d2fd14 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Thu, 7 May 2020 22:46:06 +0300 Subject: [PATCH] No need to use malloc here, the buffer never gets large --- BootROMs/pb12.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/BootROMs/pb12.c b/BootROMs/pb12.c index 9ab38fcd..3f6d5f8e 100644 --- a/BootROMs/pb12.c +++ b/BootROMs/pb12.c @@ -23,7 +23,7 @@ int main() size--; } - uint8_t *literals = NULL; + uint8_t literals[8]; size_t literals_size = 0; unsigned bits = 0; unsigned control = 0; @@ -67,8 +67,7 @@ int main() } } if (!found) { - literals = realloc(literals, ++literals_size); - literals[literals_size - 1] = byte; + literals[literals_size++] = byte; } } @@ -87,9 +86,5 @@ int main() uint8_t end_byte = 1; write(STDOUT_FILENO, &end_byte, 1); - if (literals) { - free(literals); - } - return 0; }