From d9fc95f842a90112a4a37ce3df2689525a2ce021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 26 Oct 2023 10:54:28 +0200 Subject: [PATCH] Fix assertion failure when using -X and lock-file in configuration When 'lock-file ' was used in configuration at the same time as using `-X ` in `named` invocation, there was an invalid logic that would lead to a double isc_mem_strdup() call on the value. Skip the second allocation if `lock-file` is being used in configuration, so the is used only single time. (cherry picked from commit 4f68def5e966f0d359833b64837e25f0cb60fb6a) --- bin/named/server.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/named/server.c b/bin/named/server.c index 2f21fc5213..3295082f9d 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -8443,10 +8443,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); }