qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi <stefanha@gmail.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] sparc-dis: Remove redundant NULL check
Date: Wed, 05 Sep 2012 17:51:27 +0200	[thread overview]
Message-ID: <504774FF.6000501@suse.de> (raw)
In-Reply-To: <1346703803-22003-1-git-send-email-sw@weilnetz.de>

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 <sw@weilnetz.de>
> ---
> 
> 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

  parent reply	other threads:[~2012-09-05 15:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-03 20:23 [Qemu-devel] [PATCH] sparc-dis: Remove redundant NULL check Stefan Weil
2012-09-05  9:34 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-09-05 15:51 ` Andreas Färber [this message]
2012-09-05 16:55   ` [Qemu-devel] " Stefan Hajnoczi
2012-09-05 17:15     ` Stefan Weil
2012-09-05 17:45       ` Stefan Weil
2012-09-20 17:03         ` Stefan Weil
2012-09-21  8:06           ` Andreas Färber
2012-09-05 18:13   ` Stefan Weil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=504774FF.6000501@suse.de \
    --to=afaerber@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).