[Asterisk-code-review] hashtab: Use ast free. (asterisk[15])

Joshua Colp asteriskteam at digium.com
Wed Oct 25 07:30:08 CDT 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/6890 )

Change subject: hashtab: Use ast_free.
......................................................................

hashtab: Use ast_free.

A few places in hashtab use free instead of ast_free, remove declaration
of ASTMM_LIBC from hashtab.c as it's no longer needed.

Change-Id: I2ff089bad71640c03c3ce97f1b00fc962ef79427
---
M main/hashtab.c
1 file changed, 7 insertions(+), 8 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/main/hashtab.c b/main/hashtab.c
index 3d7b199..eefe443 100644
--- a/main/hashtab.c
+++ b/main/hashtab.c
@@ -26,7 +26,6 @@
 	<support_level>core</support_level>
  ***/
 
-#define ASTMM_LIBC ASTMM_REDIRECT
 #include "asterisk.h"
 
 #include <ctype.h>
@@ -292,7 +291,7 @@
 		ast_calloc(tab->hash_tab_size, sizeof(*(ht->array)))
 #endif
 		)) {
-		free(ht);
+		ast_free(ht);
 		return NULL;
 	}
 
@@ -408,20 +407,20 @@
 				}
 
 				tlist_del_item(&(tab->tlist), tab->tlist);
-				free(t);
+				ast_free(t);
 			}
 
 			for (i = 0; i < tab->hash_tab_size; i++) {
 				/* Not totally necessary, but best to destroy old pointers */
 				tab->array[i] = NULL;
 			}
-			free(tab->array);
+			ast_free(tab->array);
 		}
 		if (tab->do_locking) {
 			ast_rwlock_unlock(&tab->lock);
 			ast_rwlock_destroy(&tab->lock);
 		}
-		free(tab);
+		ast_free(tab);
 	}
 }
 
@@ -656,7 +655,7 @@
 											why leave ptrs laying around */
 		tab->array[i] = 0; /* erase old ptrs */
 	}
-	free(tab->array);
+	ast_free(tab->array);
 	if (!(tab->array =
 #ifdef __AST_DEBUG_MALLOC
 		__ast_calloc(newsize, sizeof(*(tab->array)), file, lineno, func)
@@ -748,7 +747,7 @@
 		return;
 	if (it->tab->do_locking)
 		ast_rwlock_unlock(&it->tab->lock);
-	free(it);
+	ast_free(it);
 }
 
 void *ast_hashtab_next(struct ast_hashtab_iter *it)
@@ -781,7 +780,7 @@
 
 	obj2 = b->object;
 	b->object = b->next = (void*)2;
-	free(b); /* free up the hashbucket */
+	ast_free(b); /* free up the hashbucket */
 	tab->hash_tab_elements--;
 #ifdef DEBUG
 	{

-- 
To view, visit https://gerrit.asterisk.org/6890
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I2ff089bad71640c03c3ce97f1b00fc962ef79427
Gerrit-Change-Number: 6890
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171025/0dc754db/attachment.html>


More information about the asterisk-code-review mailing list