various files - fix some alerts raised by lgtm code analysis

This patch fixes several issues reported by the lgtm code analysis tool:

https://lgtm.com/projects/g/asterisk/asterisk

Not all reported issues were addressed in this patch. This patch mostly fixes
confirmed reported errors, potential problematic code points, and a few other
"low hanging" warnings or recommendations found in core supported modules.
These include, but are not limited to the following:

* innapropriate stack allocation in loops
* buffer overflows
* variable declaration "hiding" another variable declaration
* comparisons results that are always the same
* ambiguously signed bit-field members
* missing header guards

Change-Id: Id4a881686605d26c94ab5409bc70fcc21efacc25
This commit is contained in:
Kevin Harwell
2019-10-23 12:36:17 -05:00
committed by George Joseph
parent 990a91b44a
commit bdd785d31c
49 changed files with 324 additions and 203 deletions

View File

@@ -863,13 +863,13 @@ static void caching_topic_exec(void *data, struct stasis_subscription *sub,
* continue to grow unabated.
*/
if (strcmp(change->description, "Unsubscribe") == 0) {
struct stasis_cache_entry *sub;
struct stasis_cache_entry *cached_sub;
ao2_wrlock(caching_topic->cache->entries);
sub = cache_find(caching_topic->cache->entries, stasis_subscription_change_type(), change->uniqueid);
if (sub) {
ao2_cleanup(cache_remove(caching_topic->cache->entries, sub, stasis_message_eid(message)));
ao2_cleanup(sub);
cached_sub = cache_find(caching_topic->cache->entries, stasis_subscription_change_type(), change->uniqueid);
if (cached_sub) {
ao2_cleanup(cache_remove(caching_topic->cache->entries, cached_sub, stasis_message_eid(message)));
ao2_cleanup(cached_sub);
}
ao2_unlock(caching_topic->cache->entries);
ao2_cleanup(caching_topic_needs_unref);