Re: [PATCH 06/32] tools:iio:generic_buffer: add check before free

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

 



On 31/05/15 13:39, Hartmut Knaack wrote:
> The string trigger_name only gets dynamically allocated, if
> !notrigger == true. Therefore add this check before freeing the string.
> 
> Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx>
Under the notrigger condition, trigger_name is null and free is a noop
on a NULL pointer.  Could be argued that it is more logical not to free
it though!




> ---
>  tools/iio/generic_buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c
> index 0410948..51ae3df 100644
> --- a/tools/iio/generic_buffer.c
> +++ b/tools/iio/generic_buffer.c
> @@ -358,7 +358,7 @@ error_free_channels:
>  	}
>  	free(channels);
>  error_free_triggername:
> -	if (datardytrigger)
> +	if (datardytrigger && !notrigger)
>  		free(trigger_name);
>  error_free_dev_dir_name:
>  	free(dev_dir_name);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux