]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix assertion failure when using -X and lock-file in configuration
authorOndřej Surý <ondrej@isc.org>
Thu, 26 Oct 2023 08:54:28 +0000 (10:54 +0200)
committerOndřej Surý <ondrej@isc.org>
Thu, 26 Oct 2023 09:01:17 +0000 (11:01 +0200)
When 'lock-file <lockfile1>' was used in configuration at the same time
as using `-X <lockfile2>` in `named` invocation, there was an invalid
logic that would lead to a double isc_mem_strdup() call on the
<lockfile2> value.

Skip the second allocation if `lock-file` is being used in
configuration, so the <lockfile2> is used only single time.

bin/named/server.c

index 9333d206c85467a8eff53ea5709fd2bd8fb787d0..e2d49b7341dd5c0cf9e823d0cad245363fed1b8f 100644 (file)
@@ -8187,10 +8187,7 @@ check_lockfile(named_server_t *server, const cfg_obj_t *config,
                if (server->lockfile == NULL) {
                        return (ISC_R_NOMEMORY);
                }
-       }
-
-       if (named_g_forcelock && named_g_defaultlockfile != NULL) {
-               INSIST(server->lockfile == NULL);
+       } else if (named_g_forcelock && named_g_defaultlockfile != NULL) {
                server->lockfile = isc_mem_strdup(server->mctx,
                                                  named_g_defaultlockfile);
        }