The file that is opened is not closed in all cases. Fix it.
Reported-by: Coverity (CID: 138490)
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
ret = fdt_property_placeholder(fdt, "data", sbuf.st_size, &ptr);
if (ret)
- return ret;
+ goto err;
ret = read(fd, ptr, sbuf.st_size);
if (ret != sbuf.st_size) {
fprintf(stderr, "%s: Can't read %s: %s\n",
params->cmdname, fname, strerror(errno));
goto err;
}
+ close(fd);
return 0;
err: