diff options
author | Andreas Kotes <count@flatline.de> | 2014-04-15 12:13:13 +0200 |
---|---|---|
committer | Andreas Kotes <count@flatline.de> | 2014-04-15 12:13:13 +0200 |
commit | 2a5819c9965b6fa296f8a2ace7aaf70156ee9f90 (patch) | |
tree | f1c46281ac917e7679fa0facfe2f928bf71e5e1f /vchat-protocol.c | |
parent | 6119ae5156c3f01576d8bdefb8b861a45be372fb (diff) |
handle SSL I/O errors more gracefully, avoid double free
Diffstat (limited to 'vchat-protocol.c')
-rwxr-xr-x | vchat-protocol.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/vchat-protocol.c b/vchat-protocol.c index b50f511..e676b28 100755 --- a/vchat-protocol.c +++ b/vchat-protocol.c | |||
@@ -166,8 +166,11 @@ vcconnect (char *server, char *port) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | /* upgrade our plain BIO to ssl */ | 168 | /* upgrade our plain BIO to ssl */ |
169 | if( vc_connect_ssl( &server_conn, &vc_store ) ) | 169 | if( vc_connect_ssl( &server_conn, &vc_store ) ) { |
170 | BIO_free_all( server_conn ); | 170 | BIO_free_all( server_conn ); |
171 | server_conn = NULL; | ||
172 | errno = EIO; | ||
173 | } | ||
171 | } | 174 | } |
172 | 175 | ||
173 | if( !server_conn ) { | 176 | if( !server_conn ) { |
@@ -188,7 +191,8 @@ vcconnect (char *server, char *port) | |||
188 | /* disconnect from server */ | 191 | /* disconnect from server */ |
189 | void | 192 | void |
190 | vcdisconnect () { | 193 | vcdisconnect () { |
191 | BIO_free_all( server_conn ); | 194 | if (server_conn) |
195 | BIO_free_all( server_conn ); | ||
192 | serverfd = -1; | 196 | serverfd = -1; |
193 | } | 197 | } |
194 | 198 | ||