Blame SOURCES/kvm-io-fix-mem-leak-in-websock-error-path.patch

4a2fec
From 65fbe38c421960d5ad73e25b58593f58411422b8 Mon Sep 17 00:00:00 2001
4a2fec
From: "Daniel P. Berrange" <berrange@redhat.com>
4a2fec
Date: Wed, 20 Dec 2017 17:57:01 +0100
4a2fec
Subject: [PATCH 21/42] io: fix mem leak in websock error path
4a2fec
4a2fec
RH-Author: Daniel P. Berrange <berrange@redhat.com>
4a2fec
Message-id: <20171220175702.29663-20-berrange@redhat.com>
4a2fec
Patchwork-id: 78472
4a2fec
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH v2 19/20] io: fix mem leak in websock error path
4a2fec
Bugzilla: 1518649
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
4a2fec
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
4a2fec
Coverity pointed out the 'date' is not free()d in the error
4a2fec
path
4a2fec
4a2fec
Reviewed-by: Eric Blake <eblake@redhat.com>
4a2fec
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
4a2fec
(cherry picked from commit 7fc3fcefe2fc5966c6aa1ef4f10e9740d8d73bf2)
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 io/channel-websock.c | 3 ++-
4a2fec
 1 file changed, 2 insertions(+), 1 deletion(-)
4a2fec
4a2fec
diff --git a/io/channel-websock.c b/io/channel-websock.c
4a2fec
index aa35ef3..df2c3a9 100644
4a2fec
--- a/io/channel-websock.c
4a2fec
+++ b/io/channel-websock.c
4a2fec
@@ -341,7 +341,7 @@ static void qio_channel_websock_handshake_send_res_ok(QIOChannelWebsock *ioc,
4a2fec
     char combined_key[QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN +
4a2fec
                       QIO_CHANNEL_WEBSOCK_GUID_LEN + 1];
4a2fec
     char *accept = NULL;
4a2fec
-    char *date = qio_channel_websock_date_str();
4a2fec
+    char *date = NULL;
4a2fec
 
4a2fec
     g_strlcpy(combined_key, key, QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN + 1);
4a2fec
     g_strlcat(combined_key, QIO_CHANNEL_WEBSOCK_GUID,
4a2fec
@@ -360,6 +360,7 @@ static void qio_channel_websock_handshake_send_res_ok(QIOChannelWebsock *ioc,
4a2fec
         return;
4a2fec
     }
4a2fec
 
4a2fec
+    date = qio_channel_websock_date_str();
4a2fec
     qio_channel_websock_handshake_send_res(
4a2fec
         ioc, QIO_CHANNEL_WEBSOCK_HANDSHAKE_RES_OK, date, accept);
4a2fec
 
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec