mirror of
https://github.com/asterisk/asterisk.git
synced 2026-07-23 16:05:30 -07:00
channelstorage_cpp: Fix fallback return value in channelstorage callback
callback returned the last iterated channel when no match existed, causing invalid channel references and potential double frees. Updated to correctly return NULL when there is no match. Resolves: #1609
This commit is contained in:
committed by
Asterisk Development Team
parent
7c9133c854
commit
3e14d0cf9b
@@ -172,9 +172,8 @@ static struct ast_channel *callback(struct ast_channelstorage_instance *driver,
|
||||
rdlock(driver);
|
||||
}
|
||||
for (it = getdb(driver).begin(); it != getdb(driver).end(); it++) {
|
||||
chan = it->second;
|
||||
if (cb_fn(chan, arg, data, ao2_flags) == (CMP_MATCH | CMP_STOP)) {
|
||||
ao2_bump(chan);
|
||||
if (cb_fn(it->second, arg, data, ao2_flags) == (CMP_MATCH | CMP_STOP)) {
|
||||
chan = ao2_bump(it->second);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user