]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Fix memory leaks when failing to convert ssl-parameters.dat
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 12 Jul 2019 07:16:26 +0000 (10:16 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 12 Jul 2019 08:16:02 +0000 (11:16 +0300)
If ssl_dh setting isn't set and ssl-parameters.dat isn't found or there's
some error reading it, memory is leaked for every config request. This
eventually results in config process dying due to reaching vsz_limit.

src/config/old-set-parser.c

index 3e4812af864c7b7bd1aa061f5ccae2724a42f398..b084c7575d61785543011a2b2e5e12c8a6b3f709 100644 (file)
@@ -90,9 +90,11 @@ bool old_settings_ssl_dh_load(const char **value, const char **error_r)
                 */
                /* check moved to correct place from here */
                *value = NULL;
+               i_stream_unref(&is);
                return TRUE;
        } else if (is->stream_errno != 0) {
                *error_r = t_strdup(i_stream_get_error(is));
+               i_stream_unref(&is);
                return FALSE;
        }
 
@@ -135,9 +137,11 @@ bool old_settings_ssl_dh_load(const char **value, const char **error_r)
        } else if (is->stream_errno == ENOENT) {
                /* check for empty ssl_dh elsewhere */
                *value = NULL;
+               i_stream_unref(&is);
                return TRUE;
        } else {
                *error_r = "ssl enabled, but ssl_dh not set";
+               i_stream_unref(&is);
                return FALSE;
        }
        i_stream_unref(&is);