2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00

Fix assertion failure when using -X and lock-file in configuration

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.
This commit is contained in:
Ondřej Surý
2023-10-26 10:54:28 +02:00
parent f2225ca9af
commit 4f68def5e9

View 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);
}