From 396b0f3012955f21d7932d958fc7547532cdc90a Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sat, 26 Dec 2009 10:22:28 -0800 Subject: [PATCH] NOR: Allocate the right amount of memory Switch to calloc() to simplify review and initialization. --- src/flash/nor/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 67fd78bf7..fe5372b6c 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -401,7 +401,7 @@ int flash_write_unlock(struct target *target, struct image *image, } /* allocate padding array */ - padding = malloc(image->num_sections * sizeof(padding)); + padding = calloc(image->num_sections, sizeof(*padding)); /* loop until we reach end of the image */ while (section < image->num_sections)