From c0da0cb7614db9a6ba6e8f00cea4c86844bb3e22 Mon Sep 17 00:00:00 2001 From: Greg Kurz Date: Thu, 10 Oct 2019 11:36:04 +0200 Subject: 9p: Simplify error path of v9fs_device_realize_common() Make v9fs_device_unrealize_common() idempotent and use it for rollback, in order to reduce code duplication. Signed-off-by: Greg Kurz --- hw/9pfs/9p-proxy.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'hw/9pfs/9p-proxy.c') diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c index 57a8c1c808..97ab9c58a5 100644 --- a/hw/9pfs/9p-proxy.c +++ b/hw/9pfs/9p-proxy.c @@ -1185,6 +1185,10 @@ static void proxy_cleanup(FsContext *ctx) { V9fsProxy *proxy = ctx->private; + if (!proxy) { + return; + } + g_free(proxy->out_iovec.iov_base); g_free(proxy->in_iovec.iov_base); if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) { -- cgit 1.4.1