From: David Brownell Date: Sat, 26 Dec 2009 18:22:28 +0000 (-0800) Subject: NOR: Allocate the right amount of memory X-Git-Tag: v0.4.0-rc2~191 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=396b0f3012955f21d7932d958fc7547532cdc90a;p=openocd NOR: Allocate the right amount of memory Switch to calloc() to simplify review and initialization. --- 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)