Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753199AbdICR5f (ORCPT ); Sun, 3 Sep 2017 13:57:35 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:56372 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753061AbdICR5d (ORCPT ); Sun, 3 Sep 2017 13:57:33 -0400 Date: Sun, 03 Sep 2017 10:57:32 -0700 (PDT) Message-Id: <20170903.105732.1712307481321249919.davem@davemloft.net> To: colin.king@canonical.com Cc: tariqt@mellanox.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] net/mlx4_core: fix memory leaks on error exit path From: David Miller In-Reply-To: <20170831163053.2349-1-colin.king@canonical.com> References: <20170831163053.2349-1-colin.king@canonical.com> X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 03 Sep 2017 10:57:33 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 549 Lines: 15 From: Colin King Date: Thu, 31 Aug 2017 17:30:53 +0100 > From: Colin Ian King > > The structures hca_param and func_cap are not being kfree'd on an error > exit path causing two memory leaks. Fix this by jumping to the existing > free memory error exit path. > > Detected by CoverityScan, CID#1455219, CID#1455224 ("Resource Leak") > > Fixes: c73c8b1e47ca ("net/mlx4_core: Dynamically allocate structs at mlx4_slave_cap") > Signed-off-by: Colin Ian King Applied.