]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
tools: mkeficapsule: resource leak in read_bin_file()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 26 Jul 2025 06:31:23 +0000 (08:31 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 8 Aug 2025 06:44:52 +0000 (08:44 +0200)
Free the allocated buffer in case of an error.

Fixes: 9e63786e2b4b ("tools: mkeficapsule: rework the code a little bit")
Addresses-Coverity-ID: 345917 Resource leak
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
tools/mkeficapsule.c

index fb6c57f77c1deca40f531f3129e7a61835fa0a6b..0f41cdb64f54fdc96a162b5c459ac348edd90602 100644 (file)
@@ -168,6 +168,7 @@ static int read_bin_file(char *bin, uint8_t **data, off_t *bin_size)
        if (size < bin_stat.st_size) {
                fprintf(stderr, "read failed (%zx)\n", size);
                ret = -1;
+               free(buf);
                goto err;
        }