DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Yong Wang <wang.yong19@zte.com.cn>, harish.patil@qlogic.com
Cc: dpdk stable <stable@dpdk.org>, DPDK <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] net/qede: fix resource leak
Date: Tue, 13 Dec 2016 11:52:27 +0000	[thread overview]
Message-ID: <0addf0ed-aab6-f977-6866-472ad0663cf6@intel.com> (raw)
In-Reply-To: <1480509129-27623-1-git-send-email-wang.yong19@zte.com.cn>

On 11/30/2016 12:32 PM, Yong Wang wrote:
> Current code does not close 'fd' on function exit, leaking resources.
> 
> Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>

CC: stable@dpdk.org

> ---
>  drivers/net/qede/qede_main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c
> index ab22409..b666e1c 100644
> --- a/drivers/net/qede/qede_main.c
> +++ b/drivers/net/qede/qede_main.c
> @@ -137,6 +137,7 @@ static int qed_load_firmware_data(struct ecore_dev *edev)
>  
>  	if (fstat(fd, &st) < 0) {
>  		DP_NOTICE(edev, false, "Can't stat firmware file\n");
> +		close(fd);
>  		return -1;
>  	}
>  
> @@ -158,9 +159,11 @@ static int qed_load_firmware_data(struct ecore_dev *edev)
>  	if (edev->fw_len < 104) {
>  		DP_NOTICE(edev, false, "Invalid fw size: %" PRIu64 "\n",
>  			  edev->fw_len);
> +		close(fd);
>  		return -EINVAL;
>  	}
>  
> +	close(fd);
>  	return 0;
>  }
>  #endif
> 

      parent reply	other threads:[~2016-12-13 11:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30 12:32 Yong Wang
2016-12-08 16:52 ` Ferruh Yigit
2016-12-12 19:32   ` Harish Patil
2016-12-13 11:51     ` Ferruh Yigit
2016-12-13 11:52 ` Ferruh Yigit [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0addf0ed-aab6-f977-6866-472ad0663cf6@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=harish.patil@qlogic.com \
    --cc=stable@dpdk.org \
    --cc=wang.yong19@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).