Fix a memory leak if the socks5 server is unreachable.
authorFabian Keil <fk@fabiankeil.de>
Sun, 17 Jul 2011 13:31:35 +0000 (13:31 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sun, 17 Jul 2011 13:31:35 +0000 (13:31 +0000)
I introduced the leak after the last release so this
fix is irrelevant as far as the ChangeLog is concerned.

gateway.c

index a8da953..d43125c 100644 (file)
--- a/gateway.c
+++ b/gateway.c
@@ -1,4 +1,4 @@
-const char gateway_rcs[] = "$Id: gateway.c,v 1.72 2011/03/27 14:00:36 fabiankeil Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.73 2011/04/19 13:00:47 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/gateway.c,v $
@@ -1003,6 +1003,8 @@ static jb_socket socks5_connect(const struct forward_spec *fwd,
    {
       errstr = "socks5 server unreachable";
       log_error(LOG_LEVEL_CONNECT, "socks5_connect: %s", errstr);
    {
       errstr = "socks5 server unreachable";
       log_error(LOG_LEVEL_CONNECT, "socks5_connect: %s", errstr);
+      /* Free the generic error message provided by connect_to() */
+      freez(csp->error_message);
       csp->error_message = strdup(errstr);
       return(JB_INVALID_SOCKET);
    }
       csp->error_message = strdup(errstr);
       return(JB_INVALID_SOCKET);
    }