]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Fix file descriptor leak if "set = <file" handling fails due to fstat()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 21 Mar 2025 11:41:52 +0000 (13:41 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 26 Mar 2025 07:04:36 +0000 (07:04 +0000)
Broken by 0301f03cbe9123302a439756f54a713373b86c69

src/config/config-parser.c

index b97db6298c4be055537ee81154d3be96e7c77809..67cbc4fbb4402089d31425fc7781fd376bf04244 100644 (file)
@@ -1726,8 +1726,10 @@ str_append_file(struct config_parser_context *ctx, string_t *str,
                                           key, path);
                return -1;
        }
-       if (config_parser_add_seen_file_fd(ctx, fd, path, error_r) < 0)
+       if (config_parser_add_seen_file_fd(ctx, fd, path, error_r) < 0) {
+               i_close_fd(&fd);
                return -1;
+       }
        while ((ret = read(fd, buf, sizeof(buf))) > 0)
                str_append_data(str, buf, ret);
        if (ret < 0) {