if (fwrite(buf, size, 1, ftarget) == 1)
ret = true;
exit:
- fclose(ftarget);
- fclose(fsource);
+ if (ftarget != NULL)
+ fclose(ftarget);
+ if (fsource != NULL)
+ fclose(fsource);
free(buf);
return ret;
}
if (unlink(misspath) == 0)
util_delete_path(udev, misspath);
- set_loading(udev, loadpath, "1");
+ if (!set_loading(udev, loadpath, "1"))
+ goto exit;
util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL);
if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) {