qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vnc: Set invalid buffer pointers to NULL
@ 2009-09-19 19:00 Stefan Weil
  0 siblings, 0 replies; only message in thread
From: Stefan Weil @ 2009-09-19 19:00 UTC (permalink / raw)
  To: QEMU Developers

After qemu_free, the pointers for input and output
buffers are no longer valid, so set them to NULL
(most other calls of qemu_free in vnc.c use this
pattern, too).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 vnc.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/vnc.c b/vnc.c
index 5eaef6a..433b514 100644
--- a/vnc.c
+++ b/vnc.c
@@ -894,8 +894,14 @@ static void vnc_disconnect_start(VncState *vs)
 
 static void vnc_disconnect_finish(VncState *vs)
 {
-    if (vs->input.buffer) qemu_free(vs->input.buffer);
-    if (vs->output.buffer) qemu_free(vs->output.buffer);
+    if (vs->input.buffer) {
+        qemu_free(vs->input.buffer);
+        vs->input.buffer = NULL;
+    }
+    if (vs->output.buffer) {
+        qemu_free(vs->output.buffer);
+        vs->output.buffer = NULL;
+    }
 #ifdef CONFIG_VNC_TLS
     vnc_tls_client_cleanup(vs);
 #endif /* CONFIG_VNC_TLS */
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-19 19:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-19 19:00 [Qemu-devel] [PATCH] vnc: Set invalid buffer pointers to NULL Stefan Weil

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