aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-12-26 10:22:28 -0800
committerDavid Brownell <dbrownell@users.sourceforge.net>2009-12-26 10:22:28 -0800
commit396b0f3012955f21d7932d958fc7547532cdc90a (patch)
treeaba71be3b1f6c9642b6a4ba4f47a30a703e82dfd
parent08a890e4aae307d874bd617f4dc742a56f2064a2 (diff)
downloadriscv-openocd-396b0f3012955f21d7932d958fc7547532cdc90a.zip
riscv-openocd-396b0f3012955f21d7932d958fc7547532cdc90a.tar.gz
riscv-openocd-396b0f3012955f21d7932d958fc7547532cdc90a.tar.bz2
NOR: Allocate the right amount of memory
Switch to calloc() to simplify review and initialization.
-rw-r--r--src/flash/nor/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c
index 67fd78b..fe5372b 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)