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

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