OpenSSL: Fix memory leak during multi-message connections using STARTTLS
[exim.git] / src / src / daemon.c
index 7d55287858d067e87f9129f1d4d56a7c95855f1b..476ed296b61e57f62b7a801c1f18f788a34c8246 100644 (file)
@@ -2,7 +2,7 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) University of Cambridge 1995 - 2017 */
+/* Copyright (c) University of Cambridge 1995 - 2018 */
 /* See the file NOTICE for conditions of use and distribution. */
 
 /* Functions concerned with running Exim as a daemon */
@@ -144,8 +144,7 @@ EXIM_SOCKLEN_T ifsize = sizeof(interface_sockaddr);
 int dup_accept_socket = -1;
 int max_for_this_host = 0;
 int save_log_selector = *log_selector;
-gstring * whofrom = NULL;
-uschar * whofrom_s;
+gstring * whofrom;
 
 void *reset_point = store_get(0);
 
@@ -200,7 +199,7 @@ DEBUG(D_interface) debug_printf("interface address=%s port=%d\n",
 the local interface data. This is for logging; at the end of this function the
 memory is reclaimed. */
 
-whofrom = string_append(whofrom, 3, "[", sender_host_address, "]");
+whofrom = string_append(NULL, 3, "[", sender_host_address, "]");
 
 if (LOGGING(incoming_port))
   whofrom = string_append(whofrom, 2, ":", string_sprintf("%d", sender_host_port));
@@ -654,7 +653,7 @@ if (pid == 0)
         the data structures if necessary. */
 
 #ifdef SUPPORT_TLS
-        tls_close(TRUE, FALSE);
+        tls_close(TRUE, TLS_NO_SHUTDOWN);
 #endif
 
         /* Reset SIGHUP and SIGCHLD in the child in both cases. */