Re: [PATCH 34/38] trace-cmd mem: prevent a memory leak in trace_mem()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed,  5 Jun 2024 15:40:49 +0200
"Jerome Marchand" <jmarchan@xxxxxxxxxx> wrote:

> --- a/tracecmd/trace-mem.c
> +++ b/tracecmd/trace-mem.c
> @@ -555,9 +555,10 @@ void trace_mem(int argc, char **argv)
>  
>  	ret = tracecmd_read_headers(handle, 0);
>  	if (ret)
> -		return;
> +		goto out;
>  
>  	do_trace_mem(handle);
>  
> +out:
>  	tracecmd_close(handle);
>  }
> -- 

Would be nicer to have:

	ret = tracecmd_read_headers(handle, 0);
	if (!ret)
		do_trace_mem(handle);

	tracecmd_close(handle);

-- Steve





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux