qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 6/6] audio: Fix using freed pointer in wav_fi


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2 6/6] audio: Fix using freed pointer in wav_fini_out()
Date: Wed, 28 May 2014 15:45:01 +0200

On Wed, May 28, 2014 at 3:21 PM,  <address@hidden> wrote:
> From: Gonglei <address@hidden>
>
> Spotted by Coverity:
>
> (8) Event freed_arg:  "fclose(FILE *)" frees "wav->f".
> (9) Event cond_true:  Condition "fclose(wav->f)", taking true branch
> Also see events:  [pass_freed_arg]
>
> 212         if (fclose (wav->f))  {
> (10) Event pass_freed_arg:  Passing freed pointer "wav->f" as an argument
> to function "AUD_log(char const *, char const *, ...)".
> Also see events:  [freed_arg]
>
> 213             dolog ("wav_fini_out: fclose %p failed\nReason: %s\n",
> 214                    wav->f, strerror (errno));
>
> Removed wav->f's pointer in error log, actually it's uselessly.
>
> Signed-off-by: Gonglei <address@hidden>
> Reviewed-by: Paolo Bonzini <address@hidden>
> ---
>  audio/wavaudio.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/audio/wavaudio.c b/audio/wavaudio.c
> index 6846a1a..9bbe8e9 100644
> --- a/audio/wavaudio.c
> +++ b/audio/wavaudio.c
> @@ -210,8 +210,8 @@ static void wav_fini_out (HWVoiceOut *hw)
>
>   doclose:
>      if (fclose (wav->f))  {
> -        dolog ("wav_fini_out: fclose %p failed\nReason: %s\n",
> -               wav->f, strerror (errno));
> +        dolog ("wav_fini_out: fclose 'wav->f' failed\nReason: %s\n",
> +              strerror (errno));

This patch mainly just silences Coverity.  Printing the old pointer
value is a bit useless but doesn't pose a problem.

Reviewed-by: Stefan Hajnoczi <address@hidden>



reply via email to

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