aboutsummaryrefslogtreecommitdiffstats
path: root/main/loader.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-06 21:20:11 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-06 21:20:11 +0000
commiteb5d461ed4688cafadc76bebf329a2fae454dc12 (patch)
tree5503cb153c9de46c07e3a0a521cc996926ed375b /main/loader.c
parent125558c76fd4870a9133e4974cce6410c89a3593 (diff)
Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67864 f38db490-d61c-443f-a65b-d21fe96a405b
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);