if (fd < 0) {
fprintf(stderr, "%s: Can't open %s: %s\n",
params->cmdname, fname, strerror(errno));
- goto err;
+ goto err_buf;
}
ret = write(fd, buf, size);
if (ret != size) {
ret = -EIO;
goto err;
}
+ free(buf);
close(fd);
return 0;
ret = 0;
err:
+ munmap(old_fdt, sbuf.st_size);
free(fdt);
close(fd);
return ret;