Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lm_old_socket_close() leaks a file descriptor if connect() has not succeeded #2

Open
emezeske opened this issue Sep 18, 2009 · 1 comment

Comments

@emezeske
Copy link

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. This patch contains my fix for the problem (why doesn't github have attachments yet?):

diff -crB engineyard-loudmouth.old/loudmouth/lm-old-socket.c engineyard-loudmouth.new/loudmouth/lm-old-socket.c
*** engineyard-loudmouth.old/loudmouth/lm-old-socket.c 2009-09-17 19:34:58.000000000 -0700
--- engineyard-loudmouth.new/loudmouth/lm-old-socket.c 2009-09-17 19:36:54.000000000 -0700


*** 951,956 ****
--- 951,959 ----

  data = socket->connect_data;
  if (data) {
  •     if (data->io_channel) {
    
  •         socket_close_io_channel (data->io_channel);
    
  •     }
      socket->connect_data = NULL;
      g_free (data);
    
    }
@emezeske
Copy link
Author

Wow, that got butchered pretty badly. Let me try again:

diff -crB engineyard-loudmouth.old/loudmouth/lm-old-socket.c engineyard-loudmouth.new/loudmouth/lm-old-socket.c
*** engineyard-loudmouth.old/loudmouth/lm-old-socket.c      2009-09-17 19:34:58.000000000 -0700
--- engineyard-loudmouth.new/loudmouth/lm-old-socket.c      2009-09-17 19:36:54.000000000 -0700
***************
*** 951,956 ****
--- 951,959 ----

      data = socket->connect_data;
      if (data) {
+         if (data->io_channel) {
+             socket_close_io_channel (data->io_channel);
+         }
          socket->connect_data = NULL;
          g_free (data);
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant