[PATCH] conf-parser: Initialize the state to zero immediately.

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

 



On Fri, 2012-06-29 at 23:19 +0200, poljar (Damir Jeli?) wrote:
> From: "poljar (Damir Jeli?)" <poljarinho at gmail.com>
> 
> Set the state variable immediately to zero so if we fail to open the
> configuration file we don't check an uninitialized pointer and free an
> nonexistent  proplist.

Thanks, good catch!

> ---
>  src/pulsecore/conf-parser.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
> index 10b020c..acaf7b8 100644
> --- a/src/pulsecore/conf-parser.c
> +++ b/src/pulsecore/conf-parser.c
> @@ -159,6 +159,7 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_p
>      int r = -1;
>      pa_bool_t do_close = !f;
>      pa_config_parser_state state;
> +    pa_zero(state);
>  
>      pa_assert(filename);
>      pa_assert(t);

I prefer to not have any code before the assertion section, so I moved
the pa_zero() call after the assertions.

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux