Merge pull request #1242 from afaerber/fiptool-hikey-pad

fiptool: Fix use after free
This commit is contained in:
davidcunado-arm 2018-01-30 20:50:16 +00:00 committed by GitHub
commit e45820dc54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -543,7 +543,6 @@ static int pack_images(const char *filename, uint64_t toc_flags, unsigned long a
log_dbgx("Metadata size: %zu bytes", buf_size);
xfwrite(buf, buf_size, fp, filename);
free(buf);
if (verbose)
log_dbgx("Payload size: %zu bytes", payload_size);
@ -566,6 +565,7 @@ static int pack_images(const char *filename, uint64_t toc_flags, unsigned long a
while (pad_size--)
fputc(0x0, fp);
free(buf);
fclose(fp);
return 0;
}