[Spice-devel] [PATCH spice-server 1/4] Clear "msg" pointers after releasing

Frediano Ziglio fziglio at redhat.com
Wed Feb 15 11:31:58 UTC 2017


Avoid possible dangling pointers.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-channel-client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 9ab22e4..32db186 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -1277,6 +1277,7 @@ static void red_channel_client_handle_incoming(RedChannelClient *rcc)
             if (bytes_read == -1) {
                 red_channel_client_release_msg_buf(rcc, msg_type, msg_size,
                                                    buffer->msg);
+                buffer->msg = NULL;
                 red_channel_client_disconnect(rcc);
                 return;
             }
@@ -1296,6 +1297,7 @@ static void red_channel_client_handle_incoming(RedChannelClient *rcc)
             red_channel_client_release_msg_buf(rcc,
                                                msg_type, msg_size,
                                                buffer->msg);
+            buffer->msg = NULL;
             red_channel_client_disconnect(rcc);
             return;
         }
-- 
2.9.3



More information about the Spice-devel mailing list