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 <[email protected]>
---
 cmd/onenand.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cmd/onenand.c b/cmd/onenand.c
index 6e808ce3fce..90f4f52f4af 100644
--- a/cmd/onenand.c
+++ b/cmd/onenand.c
@@ -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;
        }
-- 
2.43.0

Reply via email to