diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-02-25 16:26:37 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-02-25 16:26:37 -0500 |
commit | 014d7516b0129b0bf308bf0f898405f439aeeff9 (patch) | |
tree | 391cbc1b21cc05d21bb792b22a139d7b39b2a73a | |
parent | 47715da982c0198a59e4bf9ec978772dc388abbd (diff) |
trace-cmd: Fix freeing on error in tracecmd_attach_cpu_data_fd()
tracecmd_attach_cpu_data_fd() had a few error paths that did not properly
free memory.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-output.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/trace-output.c b/trace-output.c index 9df5394..46afe48 100644 --- a/trace-output.c +++ b/trace-output.c | |||
@@ -1032,7 +1032,7 @@ int tracecmd_attach_cpu_data_fd(int fd, int cpus, char * const *cpu_data_files) | |||
1032 | 1032 | ||
1033 | handle = malloc(sizeof(*handle)); | 1033 | handle = malloc(sizeof(*handle)); |
1034 | if (!handle) | 1034 | if (!handle) |
1035 | return -1; | 1035 | goto out_free; |
1036 | memset(handle, 0, sizeof(*handle)); | 1036 | memset(handle, 0, sizeof(*handle)); |
1037 | 1037 | ||
1038 | handle->fd = fd; | 1038 | handle->fd = fd; |
@@ -1044,10 +1044,9 @@ int tracecmd_attach_cpu_data_fd(int fd, int cpus, char * const *cpu_data_files) | |||
1044 | pevent_ref(pevent); | 1044 | pevent_ref(pevent); |
1045 | handle->page_size = tracecmd_page_size(ihandle); | 1045 | handle->page_size = tracecmd_page_size(ihandle); |
1046 | 1046 | ||
1047 | if (tracecmd_append_cpu_data(handle, cpus, cpu_data_files) < 0) | 1047 | if (tracecmd_append_cpu_data(handle, cpus, cpu_data_files) >= 0) |
1048 | goto out_free; | 1048 | ret = 0; |
1049 | 1049 | ||
1050 | ret = 0; | ||
1051 | tracecmd_output_close(handle); | 1050 | tracecmd_output_close(handle); |
1052 | out_free: | 1051 | out_free: |
1053 | tracecmd_close(ihandle); | 1052 | tracecmd_close(ihandle); |