[Asterisk-code-review] hashtab: Add NULL check when destroying iterator. (asterisk[13])
Joshua Colp
asteriskteam at digium.com
Sat Nov 14 07:06:36 CST 2015
Joshua Colp has uploaded a new change for review.
https://gerrit.asterisk.org/1633
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/33/1633/1
diff --git a/main/hashtab.c b/main/hashtab.c
index 4b76597..9b334d4 100644
--- a/main/hashtab.c
+++ b/main/hashtab.c
@@ -745,6 +745,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/1633
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1bf8eec3639e5a440f1c941d3ae3893ac6ed619
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
More information about the asterisk-code-review
mailing list