From patchwork Thu Nov 17 03:16:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 9433451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3060260476 for ; Thu, 17 Nov 2016 03:17:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2656B29203 for ; Thu, 17 Nov 2016 03:17:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A5C52923E; Thu, 17 Nov 2016 03:17:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC0A729203 for ; Thu, 17 Nov 2016 03:17:48 +0000 (UTC) Received: from localhost ([::1]:56369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7DCt-0005F8-VL for patchwork-qemu-devel@patchwork.kernel.org; Wed, 16 Nov 2016 22:17:48 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+gGxAdeC3MeKTn2SzjR7Udr6wC1pmhyBtNrLvlFJdFQ=; b=qz1fxi99PnxueoP8QQSc/jEbiMvlGROzk1Hm+NYIHfoFWFxRRc/ImmgVUpgZIEpawt v/ZRrAyJAeeaIRTQtLht1ESNtW2hwCoPYCgtS4gvLpAErQjTaC52bAPFMA6Vqtu2yDXy dTn2Ntq8uP8001iuBRi5+zSaVNfvL05EUCUS3A1nzz1M2b7wodWfNSKvUvE6XsQA/Lij ZC3AZ8hPgqlx6z4Uso3m04iXMqSlq26ckgBGUZ7E1yH8S8OrQ6kPaqh2+32yJew8qQzX Sqznz5t/iHwl01DXwmahRrSD2nPpTIhZL07JP003lqjLegXdB09SiWgjZbtRp3vZiVmi QKSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+gGxAdeC3MeKTn2SzjR7Udr6wC1pmhyBtNrLvlFJdFQ=; b=mo2QpAaSY+Qe5usThy6I+10jeF55E6ldjmSfMjbbu2uCdsOOgAGTTHyny7H3J2PCGW nvMrYyVnTRC2Vs/ajgQT1lG1nRzMHeIXstCimmMRqChJktXK3zYgDn5w0xj9x+UAieOj sjTWlzGMHnEVvkeWo/p7VRlAPC0dQ30G67y9FoqBSWdoeEaYWE1oPXwQ3J5nXeLzDNDi 8cA7DzGGEx405pZIm+FR4SnecTjJec23Uso/0JmdnchP7tGm7I7vYWfqFmKQE7Spw8TL GDx4Xw+yMiAW+wlfOzpFzcPnkDRgxwgz6Z2sa3llInHjvdRzoYzcnH3MSbF0YzWR760t RSiw== X-Gm-Message-State: ABUngvewW3BUXLm5QxPVvz8yfv01uUmZSY/SBG776bg3DPhOm6hzDXwqHo+W/0th/Mkscg== X-Received: by 10.36.249.203 with SMTP id l194mr10455006ith.19.1479352636521; Wed, 16 Nov 2016 19:17:16 -0800 (PST) Received: from localhost.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id l3sm4424577iti.3.2016.11.16.19.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Nov 2016 19:17:16 -0800 (PST) From: Li Qiang To: groug@kaod.org, qemu-devel@nongnu.org Date: Wed, 16 Nov 2016 22:16:53 -0500 Message-Id: <1479352616-64991-2-git-send-email-liq3ea@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1479352616-64991-1-git-send-email-liq3ea@gmail.com> References: <1479352616-64991-1-git-send-email-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c0b::241 Subject: [Qemu-devel] [PATCH v3 1/4] 9pfs: adjust the order of resource cleanup in device unrealize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , liqiang6-s@360.cn Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 {