]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
cmd: onenand: Fix handling error path in onenand_block_test
authorFrancois Berder <fberder@outlook.fr>
Thu, 18 Dec 2025 06:48:51 +0000 (07:48 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 2 Jan 2026 21:51:54 +0000 (15:51 -0600)
If memory allocation for verify_buf fails, then one
needs to make sure that memory allocated for buf is
released.

Signed-off-by: Francois Berder <fberder@outlook.fr>
cmd/onenand.c

index 6e808ce3fce4d1214cfdef8e2f999101e73ad817..90f4f52f4af8c0ed48d0ddfdcec4488f98f9fe18 100644 (file)
@@ -236,6 +236,7 @@ static int onenand_block_test(u32 start, u32 size)
 
        verify_buf = malloc(blocksize);
        if (!verify_buf) {
+               free(buf);
                printf("Not enough malloc space available!\n");
                return -1;
        }