]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_mixmonitor.c: Fix crash in mixmonitor_ds_remove_and_free when datastore is NULL
authorTinet-mucw <mucw@ti-net.com.cn>
Fri, 26 Dec 2025 05:18:03 +0000 (21:18 -0800)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Tue, 30 Dec 2025 15:09:00 +0000 (15:09 +0000)
The datastore may be NULL, so a null pointer check needs to be added.

Resolves: #1673

apps/app_mixmonitor.c

index 1788fe061fe66e7350517878f6b222a3aede6192..3ca978dfdde7b594c605168f189951c3c7c8e13a 100644 (file)
@@ -1064,12 +1064,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);
 }