From 65389c488a2b5a2f7ff72b11ba5792a8aa501c19 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 23 Jan 2025 08:44:37 -0400 Subject: [PATCH] MT#55283 prevent erroneous swithch to DB 0 A call that gets created but then doesn't get initialised would have its Redis DB left at zero. At destruction it would then try to switch to DB zero. Fix this by using an appropriate initial value. Closes #1905 Change-Id: I852e48c5a06b732b37d2ccd5c478de4760aacd4e (cherry picked from commit add46f265a87e6e192a5d5077f1ccdadcd7260e2) (cherry picked from commit 322e00b60a1f20c575a8058a53f9b74774a94107) --- daemon/call.c | 1 + include/call.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/call.c b/daemon/call.c index 1f50687d5..c9db51e25 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -3806,6 +3806,7 @@ static struct call *call_create(const str *callid) { c->created = rtpe_now; c->dtls_cert = dtls_cert(); c->tos = rtpe_config.default_tos; + c->redis_hosted_db = -1; if (rtpe_config.cpu_affinity) c->cpu_affinity = call_socket_cpu_affinity++ % rtpe_config.cpu_affinity; else diff --git a/include/call.h b/include/call.h index d4d526607..db05823b6 100644 --- a/include/call.h +++ b/include/call.h @@ -688,7 +688,7 @@ struct call { sockaddr_t xmlrpc_callback; endpoint_t dtmf_log_dest; - unsigned int redis_hosted_db; + int redis_hosted_db; struct recording *recording; str metadata;