Dhiren Serai has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/67331 )
Change subject: fix scan build make issues ......................................................................
fix scan build make issues
scan build make was showing issues with variables using malloc for uninitialized/garbage values. For fixing that I used calloc which sets allocated memory to zero as default so it will not be uninitialized/garbage.
Change-Id: Id3390a40033408d827d89c3af4cd7b799e254271 Signed-off-by: dhirensr dhirensr@gmail.com --- M sfdp.c 1 file changed, 15 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/31/67331/1
diff --git a/sfdp.c b/sfdp.c index b549417..91e0fc2 100644 --- a/sfdp.c +++ b/sfdp.c @@ -295,7 +295,7 @@ nph + 1, nph);
/* Fetch all parameter headers, even if we don't use them all (yet). */ - hbuf = malloc((nph + 1) * 8); + hbuf = calloc(8,(nph + 1) * 8); hdrs = malloc((nph + 1) * sizeof(*hdrs)); if (hbuf == NULL || hdrs == NULL ) { msg_gerr("Out of memory!\n"); @@ -331,7 +331,7 @@ continue; }
- tbuf = malloc(len); + tbuf = calloc(1,len); if (tbuf == NULL) { msg_gerr("Out of memory!\n"); goto cleanup_hdrs;