This is an automated email from Gerrit. "Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7894
-- gerrit commit 5248806ef7826bce3add72b19cccad8bde49b0cf Author: Antonio Borneo <borneo.anto...@gmail.com> Date: Sat Sep 9 09:24:59 2023 +0200 flash: npcx: fix memory leak in npcx_flash_bank_command Recent commit 62f76b216930 ("flash/nor: add support for Nuvoton NPCX4/K3 series flash") introduces a memory leak for a missing free() on early return for an error. Add the free() on the return path on error. Change-Id: Ica8568a986802e23df2ab7bed4e8cc4bbb6305a5 Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com> Fixes: 62f76b216930 ("flash/nor: add support for Nuvoton NPCX4/K3 series flash") diff --git a/src/flash/nor/npcx.c b/src/flash/nor/npcx.c index 7304a68412..4a301f1e98 100644 --- a/src/flash/nor/npcx.c +++ b/src/flash/nor/npcx.c @@ -321,6 +321,7 @@ FLASH_BANK_COMMAND_HANDLER(npcx_flash_bank_command) npcx_bank->fiu_ver = NPCX_FIU_NPCK; } else { LOG_ERROR("%s is not a valid fiu", fiu); + free(npcx_bank); return ERROR_TARGET_INVALID; } } --