public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, hpa@zytor.com,
	mingo@redhat.com, jkacur@redhat.com, williams@redhat.com,
	peterz@infradead.org, xiaoguangrong@cn.fujitsu.com,
	fweisbec@gmail.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/core] perf trace: Fix forgotten close of file/dir
Date: Mon, 28 Dec 2009 10:09:52 GMT	[thread overview]
Message-ID: <tip-9967411e5b324a908e344d6ce66b77bd5d372c3e@git.kernel.org> (raw)
In-Reply-To: <4B387122.7090801@cn.fujitsu.com>

Commit-ID:  9967411e5b324a908e344d6ce66b77bd5d372c3e
Gitweb:     http://git.kernel.org/tip/9967411e5b324a908e344d6ce66b77bd5d372c3e
Author:     Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
AuthorDate: Mon, 28 Dec 2009 16:49:38 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 28 Dec 2009 10:36:36 +0100

perf trace: Fix forgotten close of file/dir

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Clark Williams <williams@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <4B387122.7090801@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/util/trace-event-info.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index 535176d..407fd65 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -253,6 +253,8 @@ static void read_header_files(void)
 	write_or_die("header_page", 12);
 	write_or_die(&size, 8);
 	check_size = copy_file_fd(fd);
+	close(fd);
+
 	if (size != check_size)
 		die("wrong size for '%s' size=%lld read=%lld",
 		    path, size, check_size);
@@ -271,6 +273,7 @@ static void read_header_files(void)
 	if (size != check_size)
 		die("wrong size for '%s'", path);
 	put_tracing_file(path);
+	close(fd);
 }
 
 static bool name_in_tp_list(char *sys, struct tracepoint_path *tps)
@@ -337,6 +340,7 @@ static void copy_event_system(const char *sys, struct tracepoint_path *tps)
 
 		free(format);
 	}
+	closedir(dir);
 }
 
 static void read_ftrace_files(struct tracepoint_path *tps)
@@ -407,6 +411,7 @@ static void read_event_files(struct tracepoint_path *tps)
 		free(sys);
 	}
 
+	closedir(dir);
 	put_tracing_file(path);
 }
 

  reply	other threads:[~2009-12-28 10:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28  5:10 [PATCH] perf_event: mount debugfs automatically Xiao Guangrong
2009-12-28  7:44 ` Ingo Molnar
2009-12-28  8:02   ` Xiao Guangrong
2009-12-28  8:06     ` Ingo Molnar
2009-12-28  8:47       ` [PATCH v2 1/3] perf tools: " Xiao Guangrong
2009-12-28  8:48         ` [PATCH 2/3] perf trace: cleanup find_debugfs() Xiao Guangrong
2009-12-28  8:49           ` [PATCH 3/3] perf trace: fix forgetting close file/dir Xiao Guangrong
2009-12-28 10:09             ` tip-bot for Xiao Guangrong [this message]
2009-12-28 10:09           ` [tip:perf/core] perf trace: Clean up find_debugfs() tip-bot for Xiao Guangrong
2009-12-28 10:09         ` [tip:perf/core] perf tools: Mount debugfs automatically tip-bot for Xiao Guangrong

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=tip-9967411e5b324a908e344d6ce66b77bd5d372c3e@git.kernel.org \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.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