virtiofsd: cleanup allocated resource in se
This cleans up unfreed resources in se on quiting, including se->virtio_dev, se->vu_socket_path, se->vu_socketfd. Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
c6de804670
commit
61cfc44982
@ -2532,6 +2532,13 @@ void fuse_session_destroy(struct fuse_session *se)
|
|||||||
if (se->fd != -1) {
|
if (se->fd != -1) {
|
||||||
close(se->fd);
|
close(se->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (se->vu_socket_path) {
|
||||||
|
virtio_session_close(se);
|
||||||
|
free(se->vu_socket_path);
|
||||||
|
se->vu_socket_path = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
free(se);
|
free(se);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -833,3 +833,10 @@ int virtio_session_mount(struct fuse_session *se)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void virtio_session_close(struct fuse_session *se)
|
||||||
|
{
|
||||||
|
close(se->vu_socketfd);
|
||||||
|
free(se->virtio_dev);
|
||||||
|
se->virtio_dev = NULL;
|
||||||
|
}
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
struct fuse_session;
|
struct fuse_session;
|
||||||
|
|
||||||
int virtio_session_mount(struct fuse_session *se);
|
int virtio_session_mount(struct fuse_session *se);
|
||||||
|
void virtio_session_close(struct fuse_session *se);
|
||||||
int virtio_loop(struct fuse_session *se);
|
int virtio_loop(struct fuse_session *se);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user