guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmuehl...@apache.org
Subject [1/4] incubator-guacamole-server git commit: GUACAMOLE-223: Always invoke SSL_free().
Date Tue, 28 Feb 2017 18:56:44 GMT
Repository: incubator-guacamole-server
Updated Branches:
  refs/heads/master c4903a8e3 -> c8fca9489


GUACAMOLE-223: Always invoke SSL_free().


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/821feeab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/821feeab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/821feeab

Branch: refs/heads/master
Commit: 821feeabb0b70a0d965c77d2a9af686013b660ab
Parents: f231330
Author: Michael Jumper <mjumper@apache.org>
Authored: Sat Nov 19 22:49:03 2016 -0800
Committer: Michael Jumper <mjumper@apache.org>
Committed: Sun Feb 26 14:25:50 2017 -0800

----------------------------------------------------------------------
 src/libguacd/socket-ssl.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/821feeab/src/libguacd/socket-ssl.c
----------------------------------------------------------------------
diff --git a/src/libguacd/socket-ssl.c b/src/libguacd/socket-ssl.c
index aa8664f..cfd2f66 100644
--- a/src/libguacd/socket-ssl.c
+++ b/src/libguacd/socket-ssl.c
@@ -107,6 +107,7 @@ static int __guac_socket_ssl_free_handler(guac_socket* socket) {
     /* Shutdown SSL */
     guac_socket_ssl_data* data = (guac_socket_ssl_data*) socket->data;
     SSL_shutdown(data->ssl);
+    SSL_free(data->ssl);
 
     /* Close file descriptor */
     close(data->fd);
@@ -117,23 +118,29 @@ static int __guac_socket_ssl_free_handler(guac_socket* socket) {
 
 guac_socket* guac_socket_open_secure(SSL_CTX* context, int fd) {
 
+    /* Create new SSL structure */
+    SSL* ssl = SSL_new(context);
+    if (ssl == NULL)
+        return NULL;
+
     /* Allocate socket and associated data */
     guac_socket* socket = guac_socket_alloc();
     guac_socket_ssl_data* data = malloc(sizeof(guac_socket_ssl_data));
 
     /* Init SSL */
     data->context = context;
-    data->ssl = SSL_new(context);
+    data->ssl = ssl;
     SSL_set_fd(data->ssl, fd);
 
     /* Accept SSL connection, handle errors */
-    if (SSL_accept(data->ssl) <= 0) {
+    if (SSL_accept(ssl) <= 0) {
 
         guac_error = GUAC_STATUS_INTERNAL_ERROR;
         guac_error_message = "SSL accept failed";
 
         free(data);
         guac_socket_free(socket);
+        SSL_free(ssl);
         return NULL;
     }
 


Mime
View raw message