From 1a99775f650b41907c6738dcaf598b89049070d4 Mon Sep 17 00:00:00 2001 From: Tinet-mucw Date: Thu, 25 Dec 2025 21:18:03 -0800 Subject: [PATCH] app_mixmonitor.c: Fix crash in mixmonitor_ds_remove_and_free when datastore is NULL The datastore may be NULL, so a null pointer check needs to be added. Resolves: #1673 --- apps/app_mixmonitor.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 50de99d603..20b5f2c8db 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -1069,12 +1069,10 @@ static void mixmonitor_ds_remove_and_free(struct ast_channel *chan, const char * datastore = ast_channel_datastore_find(chan, &mixmonitor_ds_info, datastore_id); - /* - * Currently the one place this function is called from guarantees a - * datastore is present, thus return checks can be avoided here. - */ - ast_channel_datastore_remove(chan, datastore); - ast_datastore_free(datastore); + if (datastore) { + ast_channel_datastore_remove(chan, datastore); + ast_datastore_free(datastore); + } ast_channel_unlock(chan); }