public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: "Wei,Jiangang" <weijg.fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH 3/5] hugemmap/hugemmap05: fix resource leak
Date: Mon, 4 May 2015 16:44:09 +0200	[thread overview]
Message-ID: <20150504144409.GB12401@rei.suse.de> (raw)
In-Reply-To: <1429840001-4970-3-git-send-email-weijg.fnst@cn.fujitsu.com>

Hi!
> ensure close FILE pointer before return
> 
> Signed-off-by: Wei,Jiangang <weijg.fnst@cn.fujitsu.com>
> ---
>  testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
> index 97d7689..8b9a05f 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c
> @@ -439,6 +439,7 @@ static int checksys(char *path, char *string, int value)
>  	if (atoi(buf) != value) {
>  		tst_resm(TFAIL, "%s is not %d but %d.", string, value,
>  			 atoi(buf));
> +		fclose(fp);
>  		return 1;
>  	}
>  	fclose(fp);
> @@ -474,6 +475,7 @@ static void init_hugepagesize(void)
>  		if (lookup(line, "Hugepagesize")) {
>  			tst_resm(TINFO, "Hugepagesize is %s kB", buf);
>  			hugepagesize = atoi(buf) * 1024;
> +			fclose(fp);
>  			return;
>  		}
>  	}

Applied, thanks.

Hint: These function can be replaced with SAFE_FILE_SCANF() and
      one comparsion.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2015-05-04 14:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24  1:46 [LTP] [PATCH 1/5] README: fix typos and remove blank lines Wei,Jiangang
2015-04-24  1:46 ` [LTP] [PATCH 2/5] kernel/fs/doio/growfiles: add parameter for printf Wei,Jiangang
2015-05-04 14:42   ` Cyril Hrubis
2015-04-24  1:46 ` [LTP] [PATCH 3/5] hugemmap/hugemmap05: fix resource leak Wei,Jiangang
2015-05-04 14:44   ` Cyril Hrubis [this message]
2015-04-24  1:46 ` [LTP] [PATCH 4/5] cpuset_cpu_hog: fix memory leak Wei,Jiangang
2015-04-24  1:46 ` [LTP] [PATCH 5/5] network/sockets/ltpClient: close fd to avoid leak Wei,Jiangang
2015-05-04 14:49   ` Cyril Hrubis

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=20150504144409.GB12401@rei.suse.de \
    --to=chrubis@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=weijg.fnst@cn.fujitsu.com \
    /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