diff mbox series

trace-cmd: avoid using uninitialized handle

Message ID 20190627152710.177848-1-gthelen@google.com (mailing list archive)
State Accepted
Commit a898ee06d331c9c056c85cd19bf6c6750861d2c3
Headers show
Series trace-cmd: avoid using uninitialized handle | expand

Commit Message

Greg Thelen June 27, 2019, 3:27 p.m. UTC
The put_together_file() 'out' error path uses uninitialized handle.
Unconditionally initialize handle.

Fixes: 9ed499fccef5 ("trace-cmd: Fix record --date flag when sending tracing data to a listener")
Signed-off-by: Greg Thelen <gthelen@google.com>
---
 tracecmd/trace-listen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steven Rostedt June 27, 2019, 3:41 p.m. UTC | #1
On Thu, 27 Jun 2019 08:27:10 -0700
Greg Thelen <gthelen@google.com> wrote:

> The put_together_file() 'out' error path uses uninitialized handle.
> Unconditionally initialize handle.

Yep, that's true.

> 
> Fixes: 9ed499fccef5 ("trace-cmd: Fix record --date flag when sending tracing data to a listener")

Thanks, I'll add this to the queue.

-- Steve

> Signed-off-by: Greg Thelen <gthelen@google.com>
> ---
>  tracecmd/trace-listen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tracecmd/trace-listen.c b/tracecmd/trace-listen.c
> index 3106022eeb39..9132582768ac 100644
> --- a/tracecmd/trace-listen.c
> +++ b/tracecmd/trace-listen.c
> @@ -626,7 +626,7 @@ static void stop_all_readers(int cpus, int *pid_array)
>  static int put_together_file(int cpus, int ofd, const char *node,
>  			     const char *port, bool write_options)
>  {
> -	struct tracecmd_output *handle;
> +	struct tracecmd_output *handle = NULL;
>  	char **temp_files;
>  	int cpu;
>  	int ret = -ENOMEM;
diff mbox series

Patch

diff --git a/tracecmd/trace-listen.c b/tracecmd/trace-listen.c
index 3106022eeb39..9132582768ac 100644
--- a/tracecmd/trace-listen.c
+++ b/tracecmd/trace-listen.c
@@ -626,7 +626,7 @@  static void stop_all_readers(int cpus, int *pid_array)
 static int put_together_file(int cpus, int ofd, const char *node,
 			     const char *port, bool write_options)
 {
-	struct tracecmd_output *handle;
+	struct tracecmd_output *handle = NULL;
 	char **temp_files;
 	int cpu;
 	int ret = -ENOMEM;