]> git.sur5r.net Git - u-boot/commitdiff
mkimage: Close the file when unable to get its size
authorSimon Glass <sjg@chromium.org>
Wed, 16 Mar 2016 13:45:37 +0000 (07:45 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 22 Mar 2016 16:16:19 +0000 (12:16 -0400)
There is a missing close() on the error path. Add it.

Reported-by: Coverity (CID: 138496)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
tools/imagetool.c

index 351211cd5387b9e727ce22501428d2a6af19cc7b..916ab964d553e2d214be17a58f1f8f86b7a36ffe 100644 (file)
@@ -107,6 +107,7 @@ int imagetool_get_filesize(struct image_tool_params *params, const char *fname)
        if (fstat(fd, &sbuf) < 0) {
                fprintf(stderr, "%s: Can't stat %s: %s\n",
                        params->cmdname, fname, strerror(errno));
+               close(fd);
                return -1;
        }
        close(fd);