dma - Fix a crash when the SMTP server does not support STARTTLS
authorMatthias Schmidt <matthias@dragonflybsd.org>
Mon, 20 Sep 2010 08:50:25 +0000 (10:50 +0200)
committerMatthias Schmidt <matthias@dragonflybsd.org>
Mon, 20 Sep 2010 08:50:25 +0000 (10:50 +0200)
Author: Peter Pentchev <roam@ringlet.net>

libexec/dma/net.c

index 55d06cf..3dc9520 100644 (file)
@@ -304,12 +304,13 @@ open_connection(struct mx_hostentry *h)
 static void
 close_connection(int fd)
 {
-       if (((config.features & SECURETRANS) != 0) &&
-           ((config.features & NOSSL) == 0))
-               SSL_shutdown(config.ssl);
+       if (config.ssl != NULL) {
+               if (((config.features & SECURETRANS) != 0) &&
+                   ((config.features & NOSSL) == 0))
+                       SSL_shutdown(config.ssl);
 
-       if (config.ssl != NULL)
                SSL_free(config.ssl);
+       }
 
        close(fd);
 }