summaryrefslogtreecommitdiff
path: root/src/core/network-openssl.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2003-11-16 23:54:52 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2003-11-16 23:54:52 +0000
commit1121a3fcb7c360eaa345d17891e0a243082d4f71 (patch)
treec08115c39e1f5f4a6b2d9543d11e2bd409e7624d /src/core/network-openssl.c
parent90c61c554847e021b3a44c21b60a34bd571745c2 (diff)
downloadirssi-1121a3fcb7c360eaa345d17891e0a243082d4f71.zip
Fixed some memory leaks.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3162 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/network-openssl.c')
-rw-r--r--src/core/network-openssl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c
index 2304ef4e..acab35f1 100644
--- a/src/core/network-openssl.c
+++ b/src/core/network-openssl.c
@@ -530,7 +530,6 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, const char *mycer
chan->ctx = ctx;
chan->got_cert = cert != NULL;
chan->verify = verify;
- g_io_channel_ref(handle);
gchan = (GIOChannel *)chan;
gchan->funcs = &irssi_ssl_channel_funcs;
@@ -541,9 +540,13 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, const char *mycer
GIOChannel *net_connect_ip_ssl(IPADDR *ip, int port, IPADDR *my_ip, const char *cert, const char *pkey, const char *cafile, const char *capath, gboolean verify)
{
- GIOChannel *gret = net_connect_ip(ip, port, my_ip);
- gret = irssi_ssl_get_iochannel(gret, cert, pkey, cafile, capath, verify);
- return gret;
+ GIOChannel *handle, *ssl_handle;
+
+ handle = net_connect_ip(ip, port, my_ip);
+ ssl_handle = irssi_ssl_get_iochannel(handle, cert, pkey, cafile, capath, verify);
+ if (ssl_handle == NULL)
+ g_io_channel_unref(handle);
+ return ssl_handle;
}
#else /* HAVE_OPENSSL */