The datastore may be NULL, so a null pointer check needs to be added.
Resolves: #1673
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);
}