From 396b0f3012955f21d7932d958fc7547532cdc90a Mon Sep 17 00:00:00 2001 From: David Brownell Date: Sat, 26 Dec 2009 10:22:28 -0800 Subject: 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(-) (limited to 'src/flash') diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 67fd78bf..fe5372b6 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) -- cgit v1.2.3