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

Tanu Kaskinen tanuk at iki.fi
Sat Jun 30 00:59:26 PDT 2012


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



More information about the pulseaudio-discuss mailing list