From adaae1731f0f496e1fa523bbc74db8610ea23311 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 23 May 2025 08:41:44 -0400 Subject: [PATCH] tools: Switch CFLAGS to -Os -Wall -Wextra (From -Og -W -Wall -pendantic) Change-Id: If094a22e7c7cd4fb175909fd12b9d8de514f1f38 --- tools/Makefile | 4 ++-- tools/mkzenboot.c | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index edd0ae61b1..4f35f7c7dd 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -5,8 +5,8 @@ # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ # \/ \/ \/ \/ \/ # -CFLAGS := -O -g -W -Wall -Wshadow -pedantic -LDFLAGS := -g +CFLAGS := -Os -Wall -Wextra +LDFLAGS := .PHONY: rbspeexenc uclpack diff --git a/tools/mkzenboot.c b/tools/mkzenboot.c index cd324e1f06..c95aa232fb 100644 --- a/tools/mkzenboot.c +++ b/tools/mkzenboot.c @@ -885,13 +885,12 @@ int mkboot(const char* infile, const char* bootfile, const char* outfile, struct return -3; } - fclose(infd); - /* Rudimentary Win32 PE reading */ if(memcmp(&buffer[0], "MZ", 2) != 0 && memcmp(&buffer[0x118], "PE", 2) != 0) { log_message("[ERR] Input file isn't an executable\n"); + fclose(infd); free(buffer); return -4; } @@ -910,6 +909,7 @@ int mkboot(const char* infile, const char* bootfile, const char* outfile, struct if(data_ptr == 0 || data_size == 0) { log_message("[ERR] Couldn't find .data section\n"); + fclose(infd); free(buffer); return -5; } @@ -920,6 +920,7 @@ int mkboot(const char* infile, const char* bootfile, const char* outfile, struct if(fw_offset == 0) { log_message("[ERR] Couldn't find firmware offset\n"); + fclose(infd); free(buffer); return -6; } @@ -927,6 +928,8 @@ int mkboot(const char* infile, const char* bootfile, const char* outfile, struct log_message("[INFO] Firmware offset is at 0x%x with size 0x%x\n", data_ptr+fw_offset, fw_size); fw_key = find_firmware_key(&buffer[0], filesize(infd)); + fclose(infd); + if(fw_key == NULL) { log_message("[ERR] Couldn't find firmware key\n");