Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp453404imu; Tue, 22 Jan 2019 23:02:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN6+01sL8tAzBnM4Vx8Dt3/u0zg/SpRGrvDlzIeDcSDrIz3QQgDjz6haUP1xdBUrMa0BVn+Z X-Received: by 2002:a63:554b:: with SMTP id f11mr1008140pgm.37.1548226948222; Tue, 22 Jan 2019 23:02:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548226948; cv=none; d=google.com; s=arc-20160816; b=BBZx/Bs/aDnD+Q8doW0+ORkf/OvgPvI9imWQ2V+R/u/7O5NYHVy3pSvBlIEw0bCamO rFwf+gfDlLpuWh3XMzPDVQ3IsSokXhSjbaxwpVFhiji5DNwJtFdZ4exdsllnuxFfGN5b 7CUIireHrxRE4JDZVmUAPz6yqbHnl2gKaXHWl8MYq/SkAkH4jWBs3wL3jC2ifbgU3Kjf XApNSav/Nrb9W3e8ijXLZ0hCI00eFAA2xXIlAcvhdspBo8Y0jFpb+8eoC25BIx29qJLw 6bQMa6WF5bcWDjafCX7kzFL5SFLnqPUvh2X9yymWL4c9FaAi7PzYBewurItr5kwqbalk V0JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=bnGzvMImQA7Vil06NXPuUd1bs9z11xtIESbNBcGOd/4=; b=gwPg0IlFYRPy4/54PrtkMI6CCcQZFx/vrbkSLCEJQazOcxGItEC6euIEj0KTLx7uFh ODh2v7es4+qr55D4gS01wmTeTG3gFcz9w0up+trNUBqwIsScJdJW5mk2huKSsS1SPYfh Q0aCIOkLUKr7N8BCsRm2ZNna02xzeDqdNAD2dsG1nmbhU0U57nNBOQtEX/a4dsQ1uWM9 0NCi3OWy5asB09+sqgjGWYVSgxFv2xr4vF43YI/Qcf95RCNCwCoA1PZK6YI+tLWvpLTU rswFn+ppueyK3fmKbpJo4PtCcsgthAodVbhIO9qFEh4mdHDqmMRs/B6xtohDzM+0tgvr Rwhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 142si17775736pfy.217.2019.01.22.23.02.12; Tue, 22 Jan 2019 23:02:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726289AbfAWHAU (ORCPT + 99 others); Wed, 23 Jan 2019 02:00:20 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:39020 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725899AbfAWHAT (ORCPT ); Wed, 23 Jan 2019 02:00:19 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D5581275B08B3A9034AD; Wed, 23 Jan 2019 15:00:17 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.408.0; Wed, 23 Jan 2019 15:00:11 +0800 From: YueHaibing To: , , , , , CC: , , YueHaibing Subject: [PATCH -next] mtd: docg3: Fix a possible memory leak of mtd->name Date: Wed, 23 Jan 2019 14:59:43 +0800 Message-ID: <20190123065943.5868-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case DOC_CHIPID_G3, mtd->name should be freed in the err handling path, which is alloced by kasprintf. Fixes: ae9d4934b2d7 ("mtd: docg3: add multiple floor support") Signed-off-by: YueHaibing --- drivers/mtd/devices/docg3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index 60ddc38..cbd25f9 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1867,6 +1867,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev) nomem4: kfree(docg3->bbt); + kfree(mtd->name); nomem3: kfree(mtd); nomem2: -- 2.7.0