Received: from eggs.gnu.org ([2001:4830:134:3::10]:40971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7DCQ-0005DW-HK for qemu-devel@nongnu.org; Wed, 16 Nov 2016 22:17:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7DCP-0004po-Mh for qemu-devel@nongnu.org; Wed, 16 Nov 2016 22:17:18 -0500 Received: from mail-it0-x241.google.com ([2607:f8b0:4001:c0b::241]:35522) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c7DCP-0004pD-FO for qemu-devel@nongnu.org; Wed, 16 Nov 2016 22:17:17 -0500 Received: by mail-it0-x241.google.com with SMTP id b123so12001117itb.2 for ; Wed, 16 Nov 2016 19:17:17 -0800 (PST) From: Li Qiang Date: Wed, 16 Nov 2016 22:16:53 -0500 Message-Id: <1479352616-64991-2-git-send-email-liq3ea@gmail.com> In-Reply-To: <1479352616-64991-1-git-send-email-liq3ea@gmail.com> References: <1479352616-64991-1-git-send-email-liq3ea@gmail.com> Subject: [Qemu-devel] [PATCH v3 1/4] 9pfs: adjust the order of resource cleanup in device unrealize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: groug@kaod.org, qemu-devel@nongnu.org Cc: liqiang6-s@360.cn, Li Qiang 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 --- Changes since the v2: -adjust the order in the error path in realize 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 aea7e9d..087b5c9 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 { -- 1.8.3.1