From: George Joseph Date: Wed, 9 Jul 2025 17:14:55 +0000 (-0600) Subject: channelstorage_cpp_map_name_id: Fix callback returning non-matching channels. X-Git-Tag: 21.10.0-rc3~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dde405c06706f19191ee4483d40c84341185a2ef;p=thirdparty%2Fasterisk.git channelstorage_cpp_map_name_id: Fix callback returning non-matching channels. When the callback() API was invoked but no channel passed the test, callback would return the last channel tested instead of NULL. It now correctly returns NULL when no channel matches. Resolves: #1288 --- diff --git a/main/channelstorage_cpp_map_name_id.cc b/main/channelstorage_cpp_map_name_id.cc index b61fa8b9aa..c3548fe50d 100644 --- a/main/channelstorage_cpp_map_name_id.cc +++ b/main/channelstorage_cpp_map_name_id.cc @@ -151,12 +151,13 @@ static struct ast_channel *callback(struct ast_channelstorage_instance *driver, chan = it->second; if (cb_fn(chan, arg, data, ao2_flags) == (CMP_MATCH | CMP_STOP)) { ao2_bump(chan); - break; + unlock(driver); + return chan; } } unlock(driver); - return chan; + return NULL; } enum cpp_map_iterator_type {