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>
This commit is contained in:
parent
61be3e59ba
commit
9967411e5b
1 changed files with 5 additions and 0 deletions
|
@ -253,6 +253,8 @@ static void read_header_files(void)
|
||||||
write_or_die("header_page", 12);
|
write_or_die("header_page", 12);
|
||||||
write_or_die(&size, 8);
|
write_or_die(&size, 8);
|
||||||
check_size = copy_file_fd(fd);
|
check_size = copy_file_fd(fd);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
if (size != check_size)
|
if (size != check_size)
|
||||||
die("wrong size for '%s' size=%lld read=%lld",
|
die("wrong size for '%s' size=%lld read=%lld",
|
||||||
path, size, check_size);
|
path, size, check_size);
|
||||||
|
@ -271,6 +273,7 @@ static void read_header_files(void)
|
||||||
if (size != check_size)
|
if (size != check_size)
|
||||||
die("wrong size for '%s'", path);
|
die("wrong size for '%s'", path);
|
||||||
put_tracing_file(path);
|
put_tracing_file(path);
|
||||||
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool name_in_tp_list(char *sys, struct tracepoint_path *tps)
|
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);
|
free(format);
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_ftrace_files(struct tracepoint_path *tps)
|
static void read_ftrace_files(struct tracepoint_path *tps)
|
||||||
|
@ -407,6 +411,7 @@ static void read_event_files(struct tracepoint_path *tps)
|
||||||
free(sys);
|
free(sys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closedir(dir);
|
||||||
put_tracing_file(path);
|
put_tracing_file(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue