summaryrefslogtreecommitdiff
path: root/main/loader.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2007-06-06 21:20:11 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2007-06-06 21:20:11 +0000
commit9d05ff8ed5f2c898370896ff7a8bb67885596ba1 (patch)
tree5503cb153c9de46c07e3a0a521cc996926ed375b /main/loader.c
parent033a3df22aa68f04327066e0567b76f73c437651 (diff)
Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/loader.c')
-rw-r--r--main/loader.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/main/loader.c b/main/loader.c
index c1b7597c9..060243ccc 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -170,7 +170,7 @@ void ast_module_unregister(const struct ast_module_info *info)
if (mod) {
AST_LIST_HEAD_DESTROY(&mod->users);
- free(mod);
+ ast_free(mod);
}
}
@@ -201,7 +201,7 @@ void __ast_module_user_remove(struct ast_module *mod, struct ast_module_user *u)
AST_LIST_REMOVE(&mod->users, u, entry);
AST_LIST_UNLOCK(&mod->users);
ast_atomic_fetchadd_int(&mod->usecount, -1);
- free(u);
+ ast_free(u);
ast_update_use_count();
}
@@ -214,7 +214,7 @@ void __ast_module_user_hangup_all(struct ast_module *mod)
while ((u = AST_LIST_REMOVE_HEAD(&mod->users, entry))) {
ast_softhangup(u->chan, AST_SOFTHANGUP_APPUNLOAD);
ast_atomic_fetchadd_int(&mod->usecount, -1);
- free(u);
+ ast_free(u);
}
AST_LIST_UNLOCK(&mod->users);
@@ -359,7 +359,7 @@ static struct ast_module *load_dynamic_module(const char *resource_in, unsigned
if (!(lib = dlopen(fn, RTLD_LAZY | RTLD_LOCAL))) {
ast_log(LOG_WARNING, "Error loading module '%s': %s\n", resource_in, dlerror());
- free(resource_being_loaded);
+ ast_free(resource_being_loaded);
return NULL;
}
@@ -396,7 +396,7 @@ static struct ast_module *load_dynamic_module(const char *resource_in, unsigned
if (!dlopen(fn, RTLD_NOLOAD | (wants_global ? RTLD_LAZY | RTLD_GLOBAL : RTLD_NOW | RTLD_LOCAL))) {
ast_log(LOG_WARNING, "Unable to promote flags on module '%s': %s\n", resource_in, dlerror());
while (!dlclose(lib));
- free(resource_being_loaded);
+ ast_free(resource_being_loaded);
return NULL;
}
#else
@@ -412,7 +412,7 @@ static struct ast_module *load_dynamic_module(const char *resource_in, unsigned
if (!(lib = dlopen(fn, wants_global ? RTLD_LAZY | RTLD_GLOBAL : RTLD_NOW | RTLD_LOCAL))) {
ast_log(LOG_WARNING, "Error loading module '%s': %s\n", resource_in, dlerror());
- free(resource_being_loaded);
+ ast_free(resource_being_loaded);
return NULL;
}
@@ -816,8 +816,8 @@ int load_modules(unsigned int preload_only)
AST_LIST_TRAVERSE_SAFE_BEGIN(&load_order, order, entry) {
if (!resource_name_match(order->resource, v->value)) {
AST_LIST_REMOVE_CURRENT(&load_order, entry);
- free(order->resource);
- free(order);
+ ast_free(order->resource);
+ ast_free(order);
}
}
AST_LIST_TRAVERSE_SAFE_END;
@@ -840,8 +840,8 @@ int load_modules(unsigned int preload_only)
case AST_MODULE_LOAD_SUCCESS:
case AST_MODULE_LOAD_DECLINE:
AST_LIST_REMOVE_CURRENT(&load_order, entry);
- free(order->resource);
- free(order);
+ ast_free(order->resource);
+ ast_free(order);
break;
case AST_MODULE_LOAD_FAILURE:
res = -1;
@@ -859,8 +859,8 @@ int load_modules(unsigned int preload_only)
case AST_MODULE_LOAD_SUCCESS:
case AST_MODULE_LOAD_DECLINE:
AST_LIST_REMOVE_CURRENT(&load_order, entry);
- free(order->resource);
- free(order);
+ ast_free(order->resource);
+ ast_free(order);
break;
case AST_MODULE_LOAD_FAILURE:
res = -1;
@@ -874,8 +874,8 @@ int load_modules(unsigned int preload_only)
done:
while ((order = AST_LIST_REMOVE_HEAD(&load_order, entry))) {
- free(order->resource);
- free(order);
+ ast_free(order->resource);
+ ast_free(order);
}
AST_LIST_UNLOCK(&module_list);