[Asterisk-code-review] hashtab: Add NULL check when destroying iterator. (asterisk[master])
Joshua Colp
asteriskteam at digium.com
Sat Nov 14 07:06:48 CST 2015
Joshua Colp has uploaded a new change for review.
https://gerrit.asterisk.org/1634
Change subject: hashtab: Add NULL check when destroying iterator.
......................................................................
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
---
M main/hashtab.c
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/34/1634/1
diff --git a/main/hashtab.c b/main/hashtab.c
index c08880c..5d54fb7 100644
--- a/main/hashtab.c
+++ b/main/hashtab.c
@@ -746,6 +746,8 @@
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);
--
To view, visit https://gerrit.asterisk.org/1634
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1bf8eec3639e5a440f1c941d3ae3893ac6ed619
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
More information about the asterisk-code-review
mailing list