[PATCH] parsers: fix uninitialize variable warning

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Sep 24 21:54:50 CDT 2014



On 09/24/2014 01:20 PM, David Soria Parra wrote:
> # HG changeset patch
> # User David Soria Parra <davidsp at fb.com>
> # Date 1411589780 25200
> #      Wed Sep 24 13:16:20 2014 -0700
> # Node ID 2ac6c99d87db382c8757063f15baa235881a38dd
> # Parent  12c0a6a7307c938daa8fcfe330a5b35a389c79be
> parsers: fix uninitialize variable warning

Looks right, and tests suite are passing. Pushed to the clowncopter.

> The heads pointer is not initialized correctly if filter is false, causing
> both clang and gcc to issue a warning. Correctly initialize heads to NULL.
>
> diff --git a/mercurial/parsers.c b/mercurial/parsers.c
> --- a/mercurial/parsers.c
> +++ b/mercurial/parsers.c
> @@ -854,7 +854,7 @@
>   {
>   	Py_ssize_t i, len, addlen;
>   	char *nothead = NULL;
> -	PyObject *heads;
> +	PyObject *heads = NULL;
>   	PyObject *filter = NULL;
>   	PyObject *filteredrevs = Py_None;

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list