summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kotes <count@flatline.de>2014-04-15 12:13:13 +0200
committerAndreas Kotes <count@flatline.de>2014-04-15 12:13:13 +0200
commit2a5819c9965b6fa296f8a2ace7aaf70156ee9f90 (patch)
treef1c46281ac917e7679fa0facfe2f928bf71e5e1f
parent6119ae5156c3f01576d8bdefb8b861a45be372fb (diff)
handle SSL I/O errors more gracefully, avoid double free
-rwxr-xr-xvchat-protocol.c8
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 */
189void 192void
190vcdisconnect () { 193vcdisconnect () {
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