system/fastboot: Fix fd leak of fastboot_filedump_upload()
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
parent
c3488c5b47
commit
78c11c31e8
@ -673,6 +673,7 @@ static int fastboot_filedump_upload(FAR struct fastboot_ctx_s *context)
|
|||||||
{
|
{
|
||||||
fb_err("Invalid argument, offset: %" PRIdOFF "\n",
|
fb_err("Invalid argument, offset: %" PRIdOFF "\n",
|
||||||
context->upload_param.u.file.offset);
|
context->upload_param.u.file.offset);
|
||||||
|
close(fd);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -690,12 +691,14 @@ static int fastboot_filedump_upload(FAR struct fastboot_ctx_s *context)
|
|||||||
nread) < 0)
|
nread) < 0)
|
||||||
{
|
{
|
||||||
fb_err("Upload failed (%zu bytes left)\n", size);
|
fb_err("Upload failed (%zu bytes left)\n", size);
|
||||||
|
close(fd);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
size -= nread;
|
size -= nread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user