[libvirt] [PATCH v2 2/3] Add test case for virHashEqual function

Stefan Berger stefanb at linux.vnet.ibm.com
Tue Jan 24 11:22:57 UTC 2012


On 01/24/2012 06:19 AM, Michal Privoznik wrote:
>
> Therefore I am pushing this under trivial and build-breaker rules (yeah,
> one thing - and perhaps the only one - i like about 4.6 gcc is enhanced
> static analysis as I spotted warning while compiling current HEAD):
>
> Author: Michal Privoznik<mprivozn at redhat.com>
> Date:   Tue Jan 24 12:09:42 2012 +0100
>
>      hashtest: Initialize variable in virHashEqual test
>
>      One of latest patches (b7bcb22ce2) enhanced testing for virHashEqual.
>      However, hash2 variable might be used uninitialized.
>
> diff --git a/tests/hashtest.c b/tests/hashtest.c
> index 6c45b01..441672c 100644
> --- a/tests/hashtest.c
> +++ b/tests/hashtest.c
> @@ -583,7 +583,7 @@ testHashEqualCompValue(const void *value1, const
> void *value2)
>   static int
>   testHashEqual(const void *data ATTRIBUTE_UNUSED)
>   {
> -    virHashTablePtr hash1, hash2;
> +    virHashTablePtr hash1, hash2 = NULL;
>       int ret = -1;
>       char keya[] = "a";
>       char keyb[] = "b";
>
ACK.





More information about the libvir-list mailing list