Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/69473 )
Change subject: flashrom.c: Position heap alloc along side check in compare_range() ......................................................................
flashrom.c: Position heap alloc along side check in compare_range()
Change-Id: I0386ac4c09a541cb9a659b2410ce49c3292ecc6e Signed-off-by: Edward O'Callaghan quasisec@google.com --- M flashrom.c 1 file changed, 12 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/73/69473/1
diff --git a/flashrom.c b/flashrom.c index 12ab525..d0a38c5 100644 --- a/flashrom.c +++ b/flashrom.c @@ -448,15 +448,16 @@ static int check_erased_range(struct flashctx *flash, unsigned int start, unsigned int len) { int ret; - uint8_t *cmpbuf = malloc(len); const uint8_t erased_value = ERASED_VALUE(flash);
+ uint8_t *cmpbuf = malloc(len); if (!cmpbuf) { msg_gerr("Out of memory!\n"); exit(1); } memset(cmpbuf, erased_value, len); ret = verify_range(flash, cmpbuf, start, len); + free(cmpbuf); return ret; }