qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] sparc-dis: Remove redundant NULL check


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH] sparc-dis: Remove redundant NULL check
Date: Wed, 05 Sep 2012 17:51:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0

Am 03.09.2012 22:23, schrieb Stefan Weil:
> Report from smatch:
> sparc-dis.c:2664 build_hash_table(14) info:
>  redundant null check on hash_buf calling free()
> 
> Signed-off-by: Stefan Weil <address@hidden>
> ---
> 
> Coding style was not fixed.
> 
> - sw
> 
>  sparc-dis.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sparc-dis.c b/sparc-dis.c
> index cdd337a..ef28835 100644
> --- a/sparc-dis.c
> +++ b/sparc-dis.c
> @@ -2660,8 +2660,7 @@ build_hash_table (const sparc_opcode **opcode_table,
>  
>    memset (hash_table, 0, HASH_SIZE * sizeof (hash_table[0]));
>    memset (hash_count, 0, HASH_SIZE * sizeof (hash_count[0]));
> -  if (hash_buf != NULL)
> -    free (hash_buf);
> +  free (hash_buf);
>    hash_buf = malloc (sizeof (* hash_buf) * num_opcodes);
>    for (i = num_opcodes - 1; i >= 0; --i)
>      {

*-dis sounds like binutils - did upstream drop the if, too?
If not, then diverging for a non-issue does not seem necessary.

Having said that, it's amazing what fixes you come up with. Did you
describe the use of that tool in some posting or in the Wiki?

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]