Skip to contentSkip to conversation

perf tool: small coverity clean ups

PATCH Applied Sanskriti Sharma 4 participants 18 messages Oct 2, 2018 – Oct 9, 2018 perf events

lore
Share & tools
lore
#0 lore raw

cover perf tool: small coverity clean ups

This patch set fixes a few coverity static code analyzer complaints. Build tested only.

Sanskriti Sharma (5):
perf strbuf: match va_{add,copy} with va_end
perf tools: cleanup trace-event-info 'tdata' leak perf tools: free 'printk' string in parse_ftrace_printk() perf tools: avoid double free in read_event_file() perf tools: free temporary 'sys' string in read_event_files()

 tools/perf/util/strbuf.c            | 10 ++++++++--
 tools/perf/util/trace-event-info.c  |  2 ++
 tools/perf/util/trace-event-parse.c |  1 +
 tools/perf/util/trace-event-read.c  |  9 +++++----
 4 files changed, 16 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/5 perf strbuf: match va_{add,copy} with va_end

Ensure that all code paths in strbuf_addv() call va_end() on the ap_saved copy that was made.

Fixes the following coverity complaint:

Error: VARARGS (CWE-237): [#def683] tools/perf/util/strbuf.c:106: missing_va_end: va_end was not called for "ap_saved".

---
 tools/perf/util/strbuf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tools/perf/util/strbuf.c +8 -2
index 3d1cf5b..9005fbe 100644
@@ -98,19 +98,25 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap)
 
 	va_copy(ap_saved, ap);
 	len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
-	if (len < 0)
+	if (len < 0) {
+		va_end(ap_saved);
 		return len;
+	}
 	if (len > strbuf_avail(sb)) {
 		ret = strbuf_grow(sb, len);
-		if (ret)
+		if (ret) {
+			va_end(ap_saved);
 			return ret;
+		}
 		len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved);
 		va_end(ap_saved);
 		if (len > strbuf_avail(sb)) {
 			pr_debug("this should not happen, your vsnprintf is broken");
+			va_end(ap_saved);
 			return -EINVAL;
 		}
 	}
+	va_end(ap_saved);
 	return strbuf_setlen(sb, sb->len + len);
 }
 
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [PATCH 1/5] perf strbuf: match va_{add,copy} with va_end

Em Tue, Oct 02, 2018 at 10:29:10AM -0400, Sanskriti Sharma escreveu:

Quoted 8 lines

Ensure that all code paths in strbuf_addv() call va_end() on the ap_saved copy that was made.

Fixes the following coverity complaint:

Error: VARARGS (CWE-237): [#def683] tools/perf/util/strbuf.c:106: missing_va_end: va_end was not called for "ap_saved".

Thanks, applied to perf/core

- Arnaldo

Quoted 39 lines
---
 tools/perf/util/strbuf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tools/perf/util/strbuf.c +8 -2
index 3d1cf5b..9005fbe 100644
@@ -98,19 +98,25 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap)
 
 	va_copy(ap_saved, ap);
 	len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
-	if (len < 0)
+	if (len < 0) {
+		va_end(ap_saved);
 		return len;
+	}
 	if (len > strbuf_avail(sb)) {
 		ret = strbuf_grow(sb, len);
-		if (ret)
+		if (ret) {
+			va_end(ap_saved);
 			return ret;
+		}
 		len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved);
 		va_end(ap_saved);
 		if (len > strbuf_avail(sb)) {
 			pr_debug("this should not happen, your vsnprintf is broken");
+			va_end(ap_saved);
 			return -EINVAL;
 		}
 	}
+	va_end(ap_saved);
 	return strbuf_setlen(sb, sb->len + len);
 }
 
Signature · 1 line
1.8.3.1
#3 lore raw

[tip:perf/core] perf strbuf: Match va_{add,copy} with va_end

In reply to Sanskriti Sharma
perf strbuf: Match va_{add,copy} with va_end
Commit-ID:  ce49d8436cffa9b7a6a5f110879d53e89dbc6746
Gitweb:     https://git.kernel.org/tip/ce49d8436cffa9b7a6a5f110879d53e89dbc6746
Author:     Sanskriti Sharma <[email protected]>
AuthorDate: Tue, 2 Oct 2018 10:29:10 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Oct 2018 14:23:44 -0300

perf strbuf: Match va_{add,copy} with va_end

Ensure that all code paths in strbuf_addv() call va_end() on the ap_saved copy that was made.

Fixes the following coverity complaint:

Error: VARARGS (CWE-237): [#def683] tools/perf/util/strbuf.c:106: missing_va_end: va_end was not called for "ap_saved".

---
 tools/perf/util/strbuf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tools/perf/util/strbuf.c +8 -2
index 3d1cf5bf7f18..9005fbe0780e 100644
@@ -98,19 +98,25 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap)
 
 	va_copy(ap_saved, ap);
 	len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);
-	if (len < 0)
+	if (len < 0) {
+		va_end(ap_saved);
 		return len;
+	}
 	if (len > strbuf_avail(sb)) {
 		ret = strbuf_grow(sb, len);
-		if (ret)
+		if (ret) {
+			va_end(ap_saved);
 			return ret;
+		}
 		len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved);
 		va_end(ap_saved);
 		if (len > strbuf_avail(sb)) {
 			pr_debug("this should not happen, your vsnprintf is broken");
+			va_end(ap_saved);
 			return -EINVAL;
 		}
 	}
+	va_end(ap_saved);
 	return strbuf_setlen(sb, sb->len + len);
 }
 
#4 lore raw

PATCH 2/5 perf tools: cleanup trace-event-info 'tdata' leak

In reply to Sanskriti Sharma

Free tracing_data structure in tracing_data_get() error paths.

Fixes the following coverity complaint:

Error: RESOURCE_LEAK (CWE-772):
leaked_storage: Variable "tdata" going out of scope leaks the storage

---
 tools/perf/util/trace-event-info.c | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/util/trace-event-info.c +2 -0
index 7b0ca7c..8ad8e75 100644
@@ -531,12 +531,14 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
 			 "/tmp/perf-XXXXXX");
 		if (!mkstemp(tdata->temp_file)) {
 			pr_debug("Can't make temp file");
+			free(tdata);
 			return NULL;
 		}
 
 		temp_fd = open(tdata->temp_file, O_RDWR);
 		if (temp_fd < 0) {
 			pr_debug("Can't read '%s'", tdata->temp_file);
+			free(tdata);
 			return NULL;
 		}
 
Signature · 1 line
1.8.3.1
#5 lore raw

Re: [PATCH 2/5] perf tools: cleanup trace-event-info 'tdata' leak

Em Tue, Oct 02, 2018 at 10:29:11AM -0400, Sanskriti Sharma escreveu:

Quoted 6 lines

Free tracing_data structure in tracing_data_get() error paths.

Fixes the following coverity complaint:

Error: RESOURCE_LEAK (CWE-772):
leaked_storage: Variable "tdata" going out of scope leaks the storage

Thanks, applied

- Arnaldo

Quoted 26 lines
---
 tools/perf/util/trace-event-info.c | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/util/trace-event-info.c +2 -0
index 7b0ca7c..8ad8e75 100644
@@ -531,12 +531,14 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
 			 "/tmp/perf-XXXXXX");
 		if (!mkstemp(tdata->temp_file)) {
 			pr_debug("Can't make temp file");
+			free(tdata);
 			return NULL;
 		}
 
 		temp_fd = open(tdata->temp_file, O_RDWR);
 		if (temp_fd < 0) {
 			pr_debug("Can't read '%s'", tdata->temp_file);
+			free(tdata);
 			return NULL;
 		}
 
Signature · 1 line
1.8.3.1
#6 lore raw

[tip:perf/core] perf tools: Cleanup trace-event-info 'tdata' leak

In reply to Sanskriti Sharma
perf tools: Cleanup trace-event-info 'tdata' leak
Commit-ID:  faedbf3fd19f2511a39397f76359e4cc6ee93072
Gitweb:     https://git.kernel.org/tip/faedbf3fd19f2511a39397f76359e4cc6ee93072
Author:     Sanskriti Sharma <[email protected]>
AuthorDate: Tue, 2 Oct 2018 10:29:11 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Oct 2018 14:23:45 -0300

perf tools: Cleanup trace-event-info 'tdata' leak

Free tracing_data structure in tracing_data_get() error paths.

Fixes the following coverity complaint:

Error: RESOURCE_LEAK (CWE-772):
leaked_storage: Variable "tdata" going out of scope leaks the storage

---
 tools/perf/util/trace-event-info.c | 2 ++
 1 file changed, 2 insertions(+)
tools/perf/util/trace-event-info.c +2 -0
index 7b0ca7cbb7de..8ad8e755127b 100644
@@ -531,12 +531,14 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
 			 "/tmp/perf-XXXXXX");
 		if (!mkstemp(tdata->temp_file)) {
 			pr_debug("Can't make temp file");
+			free(tdata);
 			return NULL;
 		}
 
 		temp_fd = open(tdata->temp_file, O_RDWR);
 		if (temp_fd < 0) {
 			pr_debug("Can't read '%s'", tdata->temp_file);
+			free(tdata);
 			return NULL;
 		}
 
#7 lore raw

PATCH 3/5 perf tools: free 'printk' string in parse_ftrace_printk()

In reply to Sanskriti Sharma

parse_ftrace_printk() tokenizes and parses a line, calling strdup() each iteration. Add code to free this temporary format string duplicate.

Fixes the following coverity complaints:

Error: RESOURCE_LEAK (CWE-772):
tools/perf/util/trace-event-parse.c:158: overwrite_var: Overwriting "printk" in "printk = strdup(fmt + 1)" leaks the storage that "printk" points to.

tools/perf/util/trace-event-parse.c:162: leaked_storage: Variable "printk" going out of scope leaks the storage it points to.

---
 tools/perf/util/trace-event-parse.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/util/trace-event-parse.c +1 -0
index e76214f..b15a9bf 100644
@@ -158,6 +158,7 @@ void parse_ftrace_printk(struct tep_handle *pevent,
 		printk = strdup(fmt+1);
 		line = strtok_r(NULL, "\n", &next);
 		tep_register_print_string(pevent, printk, addr);
+		free(printk);
 	}
 }
 
Signature · 1 line
1.8.3.1
#8 lore raw

Re: [PATCH 3/5] perf tools: free 'printk' string in parse_ftrace_printk()

Em Tue, Oct 02, 2018 at 10:29:12AM -0400, Sanskriti Sharma escreveu:

Quoted 5 lines

parse_ftrace_printk() tokenizes and parses a line, calling strdup() each iteration. Add code to free this temporary format string duplicate.

Fixes the following coverity complaints:

Quoted 7 lines

Error: RESOURCE_LEAK (CWE-772):
tools/perf/util/trace-event-parse.c:158: overwrite_var: Overwriting "printk" in "printk = strdup(fmt + 1)" leaks the storage that "printk" points to.

tools/perf/util/trace-event-parse.c:162: leaked_storage: Variable "printk" going out of scope leaks the storage it points to.

Thanks, applied.

- Arnaldo

Quoted 19 lines
---
 tools/perf/util/trace-event-parse.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/util/trace-event-parse.c +1 -0
index e76214f..b15a9bf 100644
@@ -158,6 +158,7 @@ void parse_ftrace_printk(struct tep_handle *pevent,
 		printk = strdup(fmt+1);
 		line = strtok_r(NULL, "\n", &next);
 		tep_register_print_string(pevent, printk, addr);
+		free(printk);
 	}
 }
 
Signature · 1 line
1.8.3.1
#9 lore raw

[tip:perf/core] perf tools: Free 'printk' string in parse_ftrace_printk()

In reply to Sanskriti Sharma
perf tools: Free 'printk' string in parse_ftrace_printk()
Commit-ID:  9c8a182e5a73e01afd11742a2ab887bf338fdafd
Gitweb:     https://git.kernel.org/tip/9c8a182e5a73e01afd11742a2ab887bf338fdafd
Author:     Sanskriti Sharma <[email protected]>
AuthorDate: Tue, 2 Oct 2018 10:29:12 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Oct 2018 14:23:45 -0300

perf tools: Free 'printk' string in parse_ftrace_printk()

parse_ftrace_printk() tokenizes and parses a line, calling strdup() each iteration. Add code to free this temporary format string duplicate.

Fixes the following coverity complaints:

Error: RESOURCE_LEAK (CWE-772):
tools/perf/util/trace-event-parse.c:158: overwrite_var: Overwriting "printk" in "printk = strdup(fmt + 1)" leaks the storage that "printk" points to.

tools/perf/util/trace-event-parse.c:162: leaked_storage: Variable "printk" going out of scope leaks the storage it points to.

---
 tools/perf/util/trace-event-parse.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/util/trace-event-parse.c +1 -0
index a4d7de1c96d1..02f97f5dd588 100644
@@ -158,6 +158,7 @@ void parse_ftrace_printk(struct tep_handle *pevent,
 		printk = strdup(fmt+1);
 		line = strtok_r(NULL, "\n", &next);
 		tep_register_print_string(pevent, printk, addr);
+		free(printk);
 	}
 }
 
#10 lore raw

PATCH 4/5 perf tools: avoid double free in read_event_file()

In reply to Sanskriti Sharma

The temporary 'buf' buffer allocated in read_event_file() may be freed twice. Move the free() call to the common function exit point.

Fixes the following coverity complaints:

Error: USE_AFTER_FREE (CWE-825):
tools/perf/util/trace-event-read.c:309: double_free: Calling "free" frees pointer "buf" which has already been freed.

---
 tools/perf/util/trace-event-read.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tools/perf/util/trace-event-read.c +1 -3
index 3dfc1db..6a0d0f2 100644
@@ -297,10 +297,8 @@ static int read_event_file(struct tep_handle *pevent, char *sys,
 	}
 
 	ret = do_read(buf, size);
-	if (ret < 0) {
-		free(buf);
+	if (ret < 0)
 		goto out;
-	}
 
 	ret = parse_event_file(pevent, buf, size, sys);
 	if (ret < 0)
Signature · 1 line
1.8.3.1
#11 lore raw

Re: [PATCH 4/5] perf tools: avoid double free in read_event_file()

Em Tue, Oct 02, 2018 at 10:29:13AM -0400, Sanskriti Sharma escreveu:

Quoted 8 lines

The temporary 'buf' buffer allocated in read_event_file() may be freed twice. Move the free() call to the common function exit point.

Fixes the following coverity complaints:

Error: USE_AFTER_FREE (CWE-825):
tools/perf/util/trace-event-read.c:309: double_free: Calling "free" frees pointer "buf" which has already been freed.

Thanks, applied.

- Arnaldo

Quoted 23 lines
---
 tools/perf/util/trace-event-read.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tools/perf/util/trace-event-read.c +1 -3
index 3dfc1db..6a0d0f2 100644
@@ -297,10 +297,8 @@ static int read_event_file(struct tep_handle *pevent, char *sys,
 	}
 
 	ret = do_read(buf, size);
-	if (ret < 0) {
-		free(buf);
+	if (ret < 0)
 		goto out;
-	}
 
 	ret = parse_event_file(pevent, buf, size, sys);
 	if (ret < 0)
Signature · 1 line
1.8.3.1
#12 lore raw

[tip:perf/core] perf tools: Avoid double free in read_event_file()

In reply to Sanskriti Sharma
perf tools: Avoid double free in read_event_file()
Commit-ID:  470c8f7c88de013d266e1b61044efe8937728b7f
Gitweb:     https://git.kernel.org/tip/470c8f7c88de013d266e1b61044efe8937728b7f
Author:     Sanskriti Sharma <[email protected]>
AuthorDate: Tue, 2 Oct 2018 10:29:13 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Oct 2018 14:23:46 -0300

perf tools: Avoid double free in read_event_file()

The temporary 'buf' buffer allocated in read_event_file() may be freed twice. Move the free() call to the common function exit point.

Fixes the following coverity complaints:

Error: USE_AFTER_FREE (CWE-825):
tools/perf/util/trace-event-read.c:309: double_free: Calling "free" frees pointer "buf" which has already been freed.

---
 tools/perf/util/trace-event-read.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tools/perf/util/trace-event-read.c +1 -3
index b98ee2a2eb44..a278e1eee5f5 100644
@@ -297,10 +297,8 @@ static int read_event_file(struct tep_handle *pevent, char *sys,
 	}
 
 	ret = do_read(buf, size);
-	if (ret < 0) {
-		free(buf);
+	if (ret < 0)
 		goto out;
-	}
 
 	ret = parse_event_file(pevent, buf, size, sys);
 	if (ret < 0)
#13 lore raw

PATCH 5/5 perf tools: free temporary 'sys' string in read_event_files()

In reply to Sanskriti Sharma

For each system in a given pevent, read_event_files() reads in a temporary 'sys' string. Be sure to free this string before moving onto to the next system and/or leaving read_event_files().

Fixes the following coverity complaints:

Error: RESOURCE_LEAK (CWE-772):

tools/perf/util/trace-event-read.c:343: overwrite_var: Overwriting "sys" in "sys = read_string()" leaks the storage that "sys" points to.

tools/perf/util/trace-event-read.c:353: leaked_storage: Variable "sys" going out of scope leaks the storage it points to.

---
 tools/perf/util/trace-event-read.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/trace-event-read.c +4 -1
index 6a0d0f2..dd045fd 100644
@@ -347,9 +347,12 @@ static int read_event_files(struct tep_handle *pevent)
 		for (x=0; x < count; x++) {
 			size = read8(pevent);
 			ret = read_event_file(pevent, sys, size);
-			if (ret)
+			if (ret) {
+				free(sys);
 				return ret;
+			}
 		}
+		free(sys);
 	}
 	return 0;
 }
Signature · 1 line
1.8.3.1
#14 lore raw

Re: [PATCH 5/5] perf tools: free temporary 'sys' string in read_event_files()

Em Tue, Oct 02, 2018 at 10:29:14AM -0400, Sanskriti Sharma escreveu:

Quoted 6 lines

For each system in a given pevent, read_event_files() reads in a temporary 'sys' string. Be sure to free this string before moving onto to the next system and/or leaving read_event_files().

Fixes the following coverity complaints:

Quoted 7 lines

Error: RESOURCE_LEAK (CWE-772):

tools/perf/util/trace-event-read.c:343: overwrite_var: Overwriting "sys" in "sys = read_string()" leaks the storage that "sys" points to.

tools/perf/util/trace-event-read.c:353: leaked_storage: Variable "sys" going out of scope leaks the storage it points to.

Thanks, applied.

- Arnaldo

Quoted 25 lines
---
 tools/perf/util/trace-event-read.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/trace-event-read.c +4 -1
index 6a0d0f2..dd045fd 100644
@@ -347,9 +347,12 @@ static int read_event_files(struct tep_handle *pevent)
 		for (x=0; x < count; x++) {
 			size = read8(pevent);
 			ret = read_event_file(pevent, sys, size);
-			if (ret)
+			if (ret) {
+				free(sys);
 				return ret;
+			}
 		}
+		free(sys);
 	}
 	return 0;
 }
Signature · 1 line
1.8.3.1
#15 lore raw

[tip:perf/core] perf tools: Free temporary 'sys' string in read_event_files()

In reply to Sanskriti Sharma
perf tools: Free temporary 'sys' string in read_event_files()
Commit-ID:  1e44224fb0528b4c0cc176bde2bb31e9127eb14b
Gitweb:     https://git.kernel.org/tip/1e44224fb0528b4c0cc176bde2bb31e9127eb14b
Author:     Sanskriti Sharma <[email protected]>
AuthorDate: Tue, 2 Oct 2018 10:29:14 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 8 Oct 2018 14:23:46 -0300

perf tools: Free temporary 'sys' string in read_event_files()

For each system in a given pevent, read_event_files() reads in a temporary 'sys' string. Be sure to free this string before moving onto to the next system and/or leaving read_event_files().

Fixes the following coverity complaints:

Error: RESOURCE_LEAK (CWE-772):

tools/perf/util/trace-event-read.c:343: overwrite_var: Overwriting "sys" in "sys = read_string()" leaks the storage that "sys" points to.

tools/perf/util/trace-event-read.c:353: leaked_storage: Variable "sys" going out of scope leaks the storage it points to.

---
 tools/perf/util/trace-event-read.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/util/trace-event-read.c +4 -1
index a278e1eee5f5..add8441de579 100644
@@ -347,9 +347,12 @@ static int read_event_files(struct tep_handle *pevent)
 		for (x=0; x < count; x++) {
 			size = read8(pevent);
 			ret = read_event_file(pevent, sys, size);
-			if (ret)
+			if (ret) {
+				free(sys);
 				return ret;
+			}
 		}
+		free(sys);
 	}
 	return 0;
 }
Reviewed-by on the v1 series
#16 lore raw
In reply to Sanskriti Sharma
Quoted 9 lines · Sanskriti Sharma

This patch set fixes a few coverity static code analyzer complaints. Build tested only.

Sanskriti Sharma (5):
perf strbuf: match va_{add,copy} with va_end
perf tools: cleanup trace-event-info 'tdata' leak perf tools: free 'printk' string in parse_ftrace_printk() perf tools: avoid double free in read_event_file() perf tools: free temporary 'sys' string in read_event_files()

nice, thanks for posting those

jirka

Quoted 10 lines
 tools/perf/util/strbuf.c            | 10 ++++++++--
 tools/perf/util/trace-event-info.c  |  2 ++
 tools/perf/util/trace-event-parse.c |  1 +
 tools/perf/util/trace-event-read.c  |  9 +++++----
 4 files changed, 16 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.3.1
#17 lore raw

Em Tue, Oct 02, 2018 at 06:02:13PM +0200, Jiri Olsa escreveu:

Quoted 11 lines · Sanskriti Sharma
Quoted 9 lines

This patch set fixes a few coverity static code analyzer complaints. Build tested only.

Sanskriti Sharma (5):
perf strbuf: match va_{add,copy} with va_end
perf tools: cleanup trace-event-info 'tdata' leak perf tools: free 'printk' string in parse_ftrace_printk() perf tools: avoid double free in read_event_file() perf tools: free temporary 'sys' string in read_event_files()

Quoted 3 lines

nice, thanks for posting those

yeah, thanks a lot!

Adding your r-by tag now.

- Arnaldo