From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 72CDEA0562; Wed, 14 Apr 2021 12:03:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60583161937; Wed, 14 Apr 2021 12:03:02 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id C8F78160DA4 for ; Wed, 14 Apr 2021 12:03:00 +0200 (CEST) IronPort-SDR: AC9fzzHCWcKe/6RI8Wz6ol79lPEy6kudq6kesEckmoT3rSPyoC3eSI6ErSNL+q9BvBEV4p8EsX r2XqC5i9WQFg== X-IronPort-AV: E=McAfee;i="6200,9189,9953"; a="279919627" X-IronPort-AV: E=Sophos;i="5.82,221,1613462400"; d="scan'208";a="279919627" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 03:02:59 -0700 IronPort-SDR: omtd8cYzDCGBgjU0eHMxmn/ktWZZPObmZ+mqpzDu1z3qVFsL3Ye0WsqzK74/HIgasd85lmhV1q WlmWuZecWBYQ== X-IronPort-AV: E=Sophos;i="5.82,221,1613462400"; d="scan'208";a="600737240" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.237.43]) ([10.213.237.43]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2021 03:02:58 -0700 From: "Burakov, Anatoly" To: "Pattan, Reshma" , "dev@dpdk.org" Cc: "Hunt, David" References: <20210413122208.101057-1-anatoly.burakov@intel.com> <7d17e135-c121-ed19-1de6-00f372255a50@intel.com> Message-ID: <99b92f1e-01e3-91f4-8d40-8f5d8b26e018@intel.com> Date: Wed, 14 Apr 2021 11:02:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <7d17e135-c121-ed19-1de6-00f372255a50@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] power: fix resource leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 14-Apr-21 11:00 AM, Burakov, Anatoly wrote: > On 14-Apr-21 10:24 AM, Pattan, Reshma wrote: >> >> >>> -----Original Message----- >>> From: Burakov, Anatoly >>>   base_max_ratio = >>>   strtoul(buf_base, NULL, >>> POWER_CONVERT_TO_DECIMAL) >>>   / BUS_FREQ; >>> +/* not needed any more */ >>> +fclose(f_base_max); >>> +f_base_max = NULL; >> >> Should this be moved before FOPS_OR_NULL_GOTO() call ? >> > > No, otherwise we wouldn't be able to read the data. It *could* be moved > to the end, but then we'd have to modify the rest of the logic as well, > because right after this there are unconditional returns there. All of > this is addressed in a refactor patch [1], this is just fixing a bug and > nothing else. > > [1] > http://patches.dpdk.org/project/dpdk/patch/20210402092701.258316-1-anatoly.burakov@intel.com/ > > Actually, no, you're right! This does have to be moved till before FOPS_OR_NULL_GOTO, because this is where we actually read the data (if we fail to read data, we leak). I hate this code :D -- Thanks, Anatoly