[libsoup/websockets-leak: 2/2] WebSockets: plug another leak in the send_message() method



commit f9ad17fd4ec44073e16354ef2aaf10859fae9cbc
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Fri Aug 30 19:27:35 2019 +0300

    WebSockets: plug another leak in the send_message() method
    
    The GByteArray allocated in the beginning is not freed in case
    of error.

 libsoup/soup-websocket-connection.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c
index 0d0ea34d..2c7fc116 100644
--- a/libsoup/soup-websocket-connection.c
+++ b/libsoup/soup-websocket-connection.c
@@ -492,6 +492,7 @@ send_message (SoupWebsocketConnection *self,
                extension = (SoupWebsocketExtension *)l->data;
                filtered_bytes = soup_websocket_extension_process_outgoing_message (extension, outer, 
filtered_bytes, &error);
                if (error) {
+                       g_byte_array_free (bytes, TRUE);
                        emit_error_and_close (self, error, FALSE);
                        return;
                }
@@ -505,6 +506,7 @@ send_message (SoupWebsocketConnection *self,
                if (length > 125) {
                        g_warning ("WebSocket control message payload exceeds size limit");
                        protocol_error_and_close (self);
+                       g_byte_array_free (bytes, TRUE);
                        g_bytes_unref (filtered_bytes);
                        return;
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]