mirror of
https://github.com/linux-msm/rmtfs.git
synced 2024-11-23 12:14:12 +08:00
storage: Use storage_close() to free up resources on exit
Use storage_close() to free up the shadow buffers as well, to avoid any lingering allocations. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
parent
bf5cb9faf2
commit
1cc12d3dc1
@ -151,8 +151,10 @@ found:
|
||||
|
||||
void storage_close(struct rmtfd *rmtfd)
|
||||
{
|
||||
if (rmtfd->fd >= 0) {
|
||||
close(rmtfd->fd);
|
||||
rmtfd->fd = -1;
|
||||
}
|
||||
|
||||
free(rmtfd->shadow_buf);
|
||||
rmtfd->shadow_buf = NULL;
|
||||
@ -189,10 +191,8 @@ void storage_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_CALLERS; i++) {
|
||||
if (rmtfds[i].fd >= 0)
|
||||
close(rmtfds[i].fd);
|
||||
}
|
||||
for (i = 0; i < MAX_CALLERS; i++)
|
||||
storage_close(&rmtfds[i]);
|
||||
}
|
||||
|
||||
ssize_t storage_pread(const struct rmtfd *rmtfd, void *buf, size_t nbyte, off_t offset)
|
||||
|
Loading…
Reference in New Issue
Block a user