summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-11-14 09:02:10 -0400
committerJoshua Colp <jcolp@digium.com>2015-11-14 08:06:35 -0500
commitafd9a89e5a0ed041d576afa1f387000404ed3c4d (patch)
tree11b5ce83f94ba92215120740b22b57ff4101322f
parent4f43b85c92050c8deba7041e687404228294d920 (diff)
hashtab: Add NULL check when destroying iterator.
The hashtab API is pretty NULL tolerant which has resulted in remaining callers not doing much checks themselves. Unfortunately the function to destroy an iterator does not do a NULL check and will result in a crash if passed NULL. This change fixes that. ASTERISK-25552 #close Change-Id: Ic1bf8eec3639e5a440f1c941d3ae3893ac6ed619
-rw-r--r--main/hashtab.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/main/hashtab.c b/main/hashtab.c
index 4b765979f..9b334d4a5 100644
--- a/main/hashtab.c
+++ b/main/hashtab.c
@@ -745,6 +745,8 @@ struct ast_hashtab_iter *ast_hashtab_start_write_traversal(struct ast_hashtab *t
void ast_hashtab_end_traversal(struct ast_hashtab_iter *it)
{
+ if (!it)
+ return;
if (it->tab->do_locking)
ast_rwlock_unlock(&it->tab->lock);
free(it);