diff options
author | Li Qiang <liq3ea@gmail.com> | 2016-11-23 13:53:34 +0100 |
---|---|---|
committer | Greg Kurz <groug@kaod.org> | 2016-11-23 13:53:34 +0100 |
commit | 898ae90a44551d25b8e956fd87372d303c82fe68 (patch) | |
tree | b3610b60dd95ce2a2f192a8e9d900d769ade6b86 /hw/9pfs | |
parent | 971f406b77a6eb84e0ad27dcc416b663765aee30 (diff) | |
download | qemu-898ae90a44551d25b8e956fd87372d303c82fe68.zip |
9pfs: add cleanup operation for proxy backend driver
In the init operation of proxy backend dirver, it allocates a
V9fsProxy struct and some other resources. We should free these
resources when the 9pfs device is unrealized. This is what this
patch does.
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Greg Kurz <groug@kaod.org>
Diffstat (limited to 'hw/9pfs')
-rw-r--r-- | hw/9pfs/9p-proxy.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c index f2417b7fd7..f4aa7a9d70 100644 --- a/hw/9pfs/9p-proxy.c +++ b/hw/9pfs/9p-proxy.c @@ -1168,9 +1168,22 @@ static int proxy_init(FsContext *ctx) return 0; } +static void proxy_cleanup(FsContext *ctx) +{ + V9fsProxy *proxy = ctx->private; + + g_free(proxy->out_iovec.iov_base); + g_free(proxy->in_iovec.iov_base); + if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) { + close(proxy->sockfd); + } + g_free(proxy); +} + FileOperations proxy_ops = { .parse_opts = proxy_parse_opts, .init = proxy_init, + .cleanup = proxy_cleanup, .lstat = proxy_lstat, .readlink = proxy_readlink, .close = proxy_close, |