]> jfr.im git - irc/unrealircd/unrealircd.git/commitdiff
Fix small memory leak if not passing the weak cipher config test (DES/3DES..)
authorBram Matthys <redacted>
Sun, 22 Apr 2018 07:37:06 +0000 (09:37 +0200)
committerBram Matthys <redacted>
Sun, 22 Apr 2018 07:37:06 +0000 (09:37 +0200)
Reported by Sky-Dancer (#5078).

src/ssl.c

index 880c34b449ac5efda3f1b074047bfa9eb4436ec4..b0a6ffb8572799bb1565fabe396e249b1a9172e4 100644 (file)
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -1074,27 +1074,30 @@ int cipher_check(SSL_CTX *ctx, char **errstr)
                if (strstr(cipher, "DES-"))
                {
                        snprintf(errbuf, sizeof(errbuf), "DES is enabled but is a weak cipher");
+                       SSL_free(ssl);
                        return 0;
                }
                else if (strstr(cipher, "3DES-"))
                {
                        snprintf(errbuf, sizeof(errbuf), "3DES is enabled but is a weak cipher");
+                       SSL_free(ssl);
                        return 0;
                }
                else if (strstr(cipher, "RC4-"))
                {
                        snprintf(errbuf, sizeof(errbuf), "RC4 is enabled but is a weak cipher");
+                       SSL_free(ssl);
                        return 0;
                }
                else if (strstr(cipher, "NULL-"))
                {
                        snprintf(errbuf, sizeof(errbuf), "NULL cipher provides no encryption");
+                       SSL_free(ssl);
                        return 0;
                }
        }
 
        SSL_free(ssl);
-
        return 1;
 }