check before use daemon->shm_info (#1229)

fix core after the command `unbound-control stop unbound`

fix:https://github.com/NLnetLabs/unbound/issues/1228

Signed-off-by: eaglegai <eaglegai@163.com>
This commit is contained in:
eaglegai 2025-01-21 22:47:51 +08:00 committed by GitHub
parent f822042cd0
commit 073c7301eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -195,7 +195,7 @@ void shm_main_shutdown(struct daemon* daemon)
{
#ifdef HAVE_SHMGET
/* web are OK, just disabled */
if(!daemon->cfg->shm_enable)
if(!daemon->cfg->shm_enable || !daemon->shm_info)
return;
verbose(VERB_DETAIL, "SHM shutdown - KEY [%d] - ID CTL [%d] ARR [%d] - PTR CTL [%p] ARR [%p]",