From: Li Qiang Date: Wed, 23 Nov 2016 12:53:34 +0000 (+0100) Subject: 9pfs: adjust the order of resource cleanup in device unrealize X-Git-Tag: qemu-xen-4.9.0-rc1~39^2~3 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4774718e5c194026ba5ee7a28d9be49be3080e42;p=qemu-xen.git 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 --- diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index aea7e9d392..087b5c98ee 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3521,8 +3521,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; @@ -3530,8 +3530,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); } typedef struct VirtfsCoResetData {