From patchwork Wed Oct 12 07:12:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 681050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sv4pb0MpXz9sfH for ; Wed, 12 Oct 2016 18:13:42 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=VCIqJ7vB; dkim-atps=neutral Received: from localhost ([::1]:59634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buDjN-00032g-A1 for incoming@patchwork.ozlabs.org; Wed, 12 Oct 2016 03:13:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buDil-0002ly-Bn for qemu-devel@nongnu.org; Wed, 12 Oct 2016 03:13:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buDii-0000YB-3q for qemu-devel@nongnu.org; Wed, 12 Oct 2016 03:12:59 -0400 Received: from mail-io0-x242.google.com ([2607:f8b0:4001:c06::242]:36660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buDih-0000Xc-VF for qemu-devel@nongnu.org; Wed, 12 Oct 2016 03:12:56 -0400 Received: by mail-io0-x242.google.com with SMTP id o141so2520095ioe.3 for ; Wed, 12 Oct 2016 00:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date; bh=C+eUZO9KxO5jxdtntR2+ukSvCxyhv9SRg1DyAwKE3Dc=; b=VCIqJ7vBiCKoffn7mabn6Vg9fxCAp9Lu9CNHQ2Gc/qQK1GVUrk6D3QO26gnxVkc+wD OLm535BwMrmN7NOyjSZDmSALsQvS/lzme6kie29FRd2cLHHaII30gN3ef0KCufqPAL2r +TC+upA5yAUJHnDSob0U6gMdXw/xv6yaFfCrpUtTAFriOGchr1h03aFB9/xWwYNS/G4B iA+yy5aeiKWkFcrKS75mOOGJrMNM8+QnAuCAh8agMr0ZEjPqmEzb3SBjzDFnMOyMXPug Xr16o/Bq9+DOV8IUb7IFncZVOj/iArWulGSbWAfGJweXUrL5nFzhAAivDLCSxty/Zo9F oPqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date; bh=C+eUZO9KxO5jxdtntR2+ukSvCxyhv9SRg1DyAwKE3Dc=; b=UHDayg7THMr1TInQpZTNSyn/r71BP7mlynQa66ehgn8XFun3/QwS/XvwHPIlLBJizr KYZ/oZN3CCXLNpgGxiKB/xQqiAEpmBEGlDr1nHy6dlvgYCsfUSSn4eT1L2jeRp1+Wd+z EwjhsqiB0uGns1hXGaY0CGIQCT21gujWicMeyz5uqo024IHpShX6QEjxVCzxJ+KWdLQd zmT6WXTVqZHSQ/tIIYyrsz9nMPiuGiWUqOg9aDfhK0qIo3+Ojn/eLbfVbd7Wyy5iCF7A u+X4PahLBIMRY79teAHlScYFVUSOmTTgdV5JsYNJLHVmnSMQKlRGpjou2rEQqh386Z51 CQJQ== X-Gm-Message-State: AA6/9Rkj4+7OjvLvuennLk8Wg3Sx1eYZWFua/TA5BeoKPI5T/2Z+0n7QXtHwKJaYJDEHyg== X-Received: by 10.107.12.88 with SMTP id w85mr134538ioi.198.1476256375553; Wed, 12 Oct 2016 00:12:55 -0700 (PDT) Received: from localhost.localdomain.localdomain ([104.192.110.250]) by smtp.gmail.com with ESMTPSA id j98sm3133088ioo.11.2016.10.12.00.12.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Oct 2016 00:12:54 -0700 (PDT) Message-ID: <57fde276.652f6b0a.4ba6d.b725@mx.google.com> X-Google-Original-Message-ID: <1476256368-7274-1-git-send-email-Qiang(liqiang6-s@360.cn)> From: Li Qiang X-Google-Original-From: Li Qiang(liqiang6-s@360.cn) To: groug@kaod.org, qemu-devel@nongnu.org Date: Wed, 12 Oct 2016 00:12:48 -0700 X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::242 Subject: [Qemu-devel] [PATCH] 9pfs: fix memory leak in v9fs_link 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 Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang In v9fs_link dispatch function, it doesn't put the 'oldfidp' fid object, this will make the 'oldfidp->ref' never reach to 0, thus leading a memory leak issue. This patch fix this. Signed-off-by: Li Qiang Reviewed-by: Greg Kurz --- hw/9pfs/9p.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 8b50bfb..29f8b7a 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2413,6 +2413,7 @@ static void v9fs_link(void *opaque) if (!err) { err = offset; } + put_fid(pdu, oldfidp); out: put_fid(pdu, dfidp); out_nofid: