lm_old_socket_close() leaks a file descriptor if connect() has not
authorFrank Zschockelt <lm@freakysoft.de>
Sat, 10 Oct 2009 19:55:27 +0200
changeset 605 8b8e7ba6634e
parent 604 1f5d313902dd
child 606 14aa64152209
lm_old_socket_close() leaks a file descriptor if connect() has not succeeded. socket_close_io_channel() is not called on the socket file descriptor if lm_old_socket_close() is called between when connect() has been called and when it has succeeded/failed. The patch came from the user emezeske on github.
loudmouth/lm-old-socket.c
--- a/loudmouth/lm-old-socket.c	Sat Oct 10 19:10:37 2009 +0200
+++ b/loudmouth/lm-old-socket.c	Sat Oct 10 19:55:27 2009 +0200
@@ -951,6 +951,9 @@
 
     data = socket->connect_data;
     if (data) {
+        if (data->io_channel) {
+	    socket_close_io_channel (data->io_channel);
+        }
         socket->connect_data = NULL;
         g_free (data);
     }