Free the buffer after a read error to prevent a memory leak. This was flagged by a Coverity scan of the coreboot project, which uses cbootimage. Signed-off-by: Jacob Garber <jgarber1@xxxxxxxxxxx> --- src/set.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/set.c b/src/set.c index 934a58d..2013169 100644 --- a/src/set.c +++ b/src/set.c @@ -98,6 +98,7 @@ read_from_image(char *filename, if (fread(*image, 1, (size_t)(*actual_size), fp) != (size_t)(*actual_size)) { result = 1; + free(*image); goto cleanup; } -- 2.22.0