浏览代码

mkimage: Close the file when unable to get its size

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>
Simon Glass 8 年之前
父节点
当前提交
b12a81c4cc
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      tools/imagetool.c

+ 1 - 0
tools/imagetool.c

@@ -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);