qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] audio: Fix using freed pointer in wav_fini_out
@ 2014-06-13  1:46 arei.gonglei
  2014-06-13  7:15 ` Markus Armbruster
  0 siblings, 1 reply; 7+ messages in thread
From: arei.gonglei @ 2014-06-13  1:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: weidong.huang, luonengjun, Gonglei, kraxel, stefanha, pbonzini

From: Gonglei <arei.gonglei@huawei.com>

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));

Drop the whole message, we can't do much when it happen after all.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 audio/wavaudio.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index 6846a1a..b81fdf9 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -209,10 +209,7 @@ 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));
-    }
+    fclose(wav->f);
     wav->f = NULL;
 
     g_free (wav->pcm_buf);
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-06-13  8:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13  1:46 [Qemu-devel] [PATCH] audio: Fix using freed pointer in wav_fini_out arei.gonglei
2014-06-13  7:15 ` Markus Armbruster
2014-06-13  7:23   ` Peter Maydell
2014-06-13  7:47   ` Paolo Bonzini
2014-06-13  7:59     ` Gerd Hoffmann
2014-06-13  8:18       ` Paolo Bonzini
2014-06-13  8:32         ` Gonglei (Arei)

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).