From 9be364d4b3bc173103bec0dc76259f40d232eb88 Mon Sep 17 00:00:00 2001 From: Li Qiang Date: Wed, 23 Nov 2016 13:53:34 +0100 Subject: [PATCH 06/12] 9pfs: adjust the order of resource cleanup in device unrealize Unrealize should undo things that were set during realize in reverse order. So should do in the error path in realize. Signed-off-by: Li Qiang Reviewed-by: Greg Kurz Signed-off-by: Greg Kurz --- hw/9pfs/9p.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index fc4f2cd..ced7b4c 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3490,8 +3490,8 @@ int v9fs_device_realize_common(V9fsState *s, Error **errp) rc = 0; out: if (rc) { - g_free(s->ctx.fs_root); g_free(s->tag); + g_free(s->ctx.fs_root); v9fs_path_free(&path); } return rc; @@ -3499,8 +3499,8 @@ out: void v9fs_device_unrealize_common(V9fsState *s, Error **errp) { - g_free(s->ctx.fs_root); g_free(s->tag); + g_free(s->ctx.fs_root); } static void __attribute__((__constructor__)) v9fs_set_fd_limit(void) -- 2.1.4