[Asterisk-code-review] hashtab: Add NULL check when destroying iterator. (asterisk[master])
Joshua Colp
asteriskteam at digium.com
Sat Nov 14 13:55:33 CST 2015
Joshua Colp has submitted this change and it was merged.
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(-)
Approvals:
Anonymous Coward #1000019: Verified
Ashley Sanders: Looks good to me, approved
Corey Farrell: Looks good to me, but someone else must approve
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: merged
Gerrit-Change-Id: Ic1bf8eec3639e5a440f1c941d3ae3893ac6ed619
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
More information about the asterisk-code-review
mailing list