aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-rw-r--r--res/res_agi.c4
-rw-r--r--res/res_config_pgsql.c6
-rw-r--r--res/res_config_sqlite.c84
-rw-r--r--res/res_features.c26
-rw-r--r--res/res_indications.c8
-rw-r--r--res/res_jabber.c57
-rw-r--r--res/res_monitor.c12
-rw-r--r--res/res_musiconhold.c24
-rw-r--r--res/res_odbc.c6
-rw-r--r--res/res_smdi.c6
-rw-r--r--res/res_speech.c12
11 files changed, 120 insertions, 125 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index f1a1f2ff0..46a26a4c9 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -130,7 +130,7 @@ static void agi_debug_cli(int fd, char *fmt, ...)
if (agidebug)
ast_verbose("AGI Tx >> %s\n", stuff);
ast_carefulwrite(fd, stuff, strlen(stuff), 100);
- free(stuff);
+ ast_free(stuff);
}
}
@@ -476,7 +476,7 @@ static int handle_recvtext(struct ast_channel *chan, AGI *agi, int argc, char *a
buf = ast_recvtext(chan,atoi(argv[2]));
if (buf) {
fdprintf(agi->fd, "200 result=1 (%s)\n", buf);
- free(buf);
+ ast_free(buf);
} else {
fdprintf(agi->fd, "200 result=-1\n");
}
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index 624522744..5b2a7ad1c 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -193,7 +193,7 @@ static struct ast_variable *realtime_pgsql(const char *database, const char *tab
}
}
}
- free(fieldnames);
+ ast_free(fieldnames);
} else {
ast_log(LOG_WARNING,
"Postgresql RealTime: Could not find any rows in table %s.\n", table);
@@ -347,7 +347,7 @@ static struct ast_config *realtime_multi_pgsql(const char *database, const char
}
ast_category_append(cfg, cat);
}
- free(fieldnames);
+ ast_free(fieldnames);
} else {
ast_log(LOG_WARNING,
"Postgresql RealTime: Could not find any rows in table %s.\n", table);
@@ -747,7 +747,7 @@ static int pgsql_reconnect(const char *database)
pgsqlConn = PQconnectdb(connInfo);
if (option_debug)
ast_log(LOG_DEBUG, "%u connInfo=%s\n", size, connInfo);
- free(connInfo);
+ ast_free(connInfo);
connInfo = NULL;
if (option_debug)
ast_log(LOG_DEBUG, "pgsqlConn=%p\n", pgsqlConn);
diff --git a/res/res_config_sqlite.c b/res/res_config_sqlite.c
index 076282e80..01bc7a493 100644
--- a/res/res_config_sqlite.c
+++ b/res/res_config_sqlite.c
@@ -593,7 +593,7 @@ static char *sql_get_config_table =
static int set_var(char **var, char *name, char *value)
{
if (*var)
- free(*var);
+ ast_free(*var);
*var = ast_strdup(value);
@@ -654,11 +654,11 @@ static int load_config(void)
static void unload_config(void)
{
- free(dbfile);
+ ast_free(dbfile);
dbfile = NULL;
- free(config_table);
+ ast_free(config_table);
config_table = NULL;
- free(cdr_table);
+ ast_free(cdr_table);
cdr_table = NULL;
}
@@ -684,7 +684,7 @@ static int cdr_handler(struct ast_cdr *cdr)
if (error) {
ast_log(LOG_ERROR, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
return 1;
}
@@ -711,7 +711,7 @@ static int add_cfg_entry(void *arg, int argc, char **argv, char **columnNames)
return 1;
}
- free(args->cat_name);
+ ast_free(args->cat_name);
args->cat_name = ast_strdup(argv[RES_SQLITE_CONFIG_CATEGORY]);
if (!args->cat_name) {
@@ -763,11 +763,11 @@ static struct ast_config *config_handler(const char *database,
ast_mutex_unlock(&mutex);
- free(args.cat_name);
+ ast_free(args.cat_name);
if (error) {
ast_log(LOG_ERROR, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
return NULL;
}
@@ -785,15 +785,15 @@ static size_t get_params(va_list ap, const char ***params_ptr, const char ***val
while ((param = va_arg(ap, const char *)) && (val = va_arg(ap, const char *))) {
if (!(tmp = ast_realloc(params, (params_count + 1) * sizeof(char *)))) {
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
return 0;
}
params = tmp;
if (!(tmp = ast_realloc(vals, (params_count + 1) * sizeof(char *)))) {
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
return 0;
}
vals = tmp;
@@ -872,8 +872,8 @@ realtime_handler(const char *database, const char *table, va_list ap)
if (!query) {
ast_log(LOG_WARNING, "Unable to allocate SQL query\n");
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
return NULL;
}
@@ -888,8 +888,8 @@ realtime_handler(const char *database, const char *table, va_list ap)
if (!tmp_str) {
ast_log(LOG_WARNING, "Unable to reallocate SQL query\n");
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
return NULL;
}
@@ -897,8 +897,8 @@ realtime_handler(const char *database, const char *table, va_list ap)
}
}
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
tmp_str = sqlite_mprintf("%s LIMIT 1;", query);
sqlite_freemem(query);
@@ -925,7 +925,7 @@ realtime_handler(const char *database, const char *table, va_list ap)
if (error) {
ast_log(LOG_WARNING, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
ast_variables_destroy(args.var);
return NULL;
}
@@ -1008,8 +1008,8 @@ static struct ast_config *realtime_multi_handler(const char *database,
if (!(initfield = ast_strdup(params[0]))) {
ast_config_destroy(cfg);
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
return NULL;
}
@@ -1034,9 +1034,9 @@ static struct ast_config *realtime_multi_handler(const char *database,
if (!(query = sqlite_mprintf(QUERY, table, params[0], op, tmp_str))) {
ast_log(LOG_WARNING, "Unable to allocate SQL query\n");
ast_config_destroy(cfg);
- free(params);
- free(vals);
- free(initfield);
+ ast_free(params);
+ ast_free(vals);
+ ast_free(initfield);
return NULL;
}
@@ -1052,9 +1052,9 @@ static struct ast_config *realtime_multi_handler(const char *database,
if (!tmp_str) {
ast_log(LOG_WARNING, "Unable to reallocate SQL query\n");
ast_config_destroy(cfg);
- free(params);
- free(vals);
- free(initfield);
+ ast_free(params);
+ ast_free(vals);
+ ast_free(initfield);
return NULL;
}
@@ -1062,13 +1062,13 @@ static struct ast_config *realtime_multi_handler(const char *database,
}
}
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
if (!(tmp_str = sqlite_mprintf("%s ORDER BY %q;", query, initfield))) {
ast_log(LOG_WARNING, "Unable to reallocate SQL query\n");
ast_config_destroy(cfg);
- free(initfield);
+ ast_free(initfield);
return NULL;
}
@@ -1087,11 +1087,11 @@ static struct ast_config *realtime_multi_handler(const char *database,
ast_mutex_unlock(&mutex);
sqlite_freemem(query);
- free(initfield);
+ ast_free(initfield);
if (error) {
ast_log(LOG_WARNING, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
ast_config_destroy(cfg);
return NULL;
}
@@ -1123,8 +1123,8 @@ static int realtime_update_handler(const char *database, const char *table,
if (!(query = sqlite_mprintf(QUERY, table, params[0], vals[0]))) {
ast_log(LOG_WARNING, "Unable to allocate SQL query\n");
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
return -1;
}
@@ -1138,8 +1138,8 @@ static int realtime_update_handler(const char *database, const char *table,
if (!tmp_str) {
ast_log(LOG_WARNING, "Unable to reallocate SQL query\n");
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
return -1;
}
@@ -1147,8 +1147,8 @@ static int realtime_update_handler(const char *database, const char *table,
}
}
- free(params);
- free(vals);
+ ast_free(params);
+ ast_free(vals);
if (!(tmp_str = sqlite_mprintf("%s WHERE %q = '%q';", query, keyfield, entity))) {
ast_log(LOG_WARNING, "Unable to reallocate SQL query\n");
@@ -1176,7 +1176,7 @@ static int realtime_update_handler(const char *database, const char *table,
if (error) {
ast_log(LOG_WARNING, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
}
return rows_num;
@@ -1239,7 +1239,7 @@ static int load_module(void)
if (!(db = sqlite_open(dbfile, 0660, &errormsg))) {
ast_log(LOG_ERROR, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
unload_module();
return 1;
}
@@ -1258,7 +1258,7 @@ static int load_module(void)
*/
if (error != SQLITE_ERROR) {
ast_log(LOG_ERROR, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
unload_module();
return 1;
}
@@ -1270,7 +1270,7 @@ static int load_module(void)
if (error) {
ast_log(LOG_ERROR, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
unload_module();
return 1;
}
diff --git a/res/res_features.c b/res/res_features.c
index cbb59a915..b4feda26c 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -287,7 +287,7 @@ static void *ast_bridge_call_thread(void *data)
ast_hangup(tobj->peer);
}
- free(tobj);
+ ast_free(tobj);
return NULL;
}
@@ -375,7 +375,7 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
if (!ast_strlen_zero(parkingexten)) {
if (ast_exists_extension(NULL, parking_con, parkingexten, 1, NULL)) {
ast_mutex_unlock(&parking_lock);
- free(pu);
+ ast_free(pu);
ast_log(LOG_WARNING, "Requested parking extension already exists: %s@%s\n", parkingexten, parking_con);
return -1; /* We failed to park this call, plain and simple so we need to error out */
}
@@ -398,7 +398,7 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
if (!(i < parking_range)) {
ast_log(LOG_WARNING, "No more parking spaces\n");
- free(pu);
+ ast_free(pu);
ast_mutex_unlock(&parking_lock);
return -1;
}
@@ -1069,7 +1069,7 @@ static struct feature_group* register_group(const char *fgname)
return NULL;
if (ast_string_field_init(fg, 128)) {
- free(fg);
+ ast_free(fg);
return NULL;
}
@@ -1093,7 +1093,7 @@ static void register_group_feature(struct feature_group *fg, const char *exten,
return;
if (ast_string_field_init(fge, 128)) {
- free(fge);
+ ast_free(fge);
return;
}
@@ -1127,7 +1127,7 @@ void ast_unregister_feature(struct ast_call_feature *feature)
AST_LIST_LOCK(&feature_list);
AST_LIST_REMOVE(&feature_list,feature,feature_entry);
AST_LIST_UNLOCK(&feature_list);
- free(feature);
+ ast_free(feature);
}
/*! \brief Remove all features in the list */
@@ -1137,7 +1137,7 @@ static void ast_unregister_features(void)
AST_LIST_LOCK(&feature_list);
while ((feature = AST_LIST_REMOVE_HEAD(&feature_list,feature_entry)))
- free(feature);
+ ast_free(feature);
AST_LIST_UNLOCK(&feature_list);
}
@@ -1164,11 +1164,11 @@ static void ast_unregister_groups(void)
while ((fg = AST_LIST_REMOVE_HEAD(&feature_groups, entry))) {
while ((fge = AST_LIST_REMOVE_HEAD(&fg->features, entry))) {
ast_string_field_free_all(fge);
- free(fge);
+ ast_free(fge);
}
ast_string_field_free_all(fg);
- free(fg);
+ ast_free(fg);
}
AST_RWLIST_UNLOCK(&feature_groups);
}
@@ -1675,7 +1675,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
} else
ast_cdr_setuserfield(chan, peer->cdr->userfield);
/* free the peer's cdr without ast_cdr_free complaining */
- free(peer->cdr);
+ ast_free(peer->cdr);
peer->cdr = NULL;
}
@@ -1986,7 +1986,7 @@ static void *do_parking_thread(void *ignore)
notify_metermaids(pt->parkingexten, parking_con);
} else
ast_log(LOG_WARNING, "Whoa, no parking context?\n");
- free(pt);
+ ast_free(pt);
} else { /* still within parking time, process descriptors */
for (x = 0; x < AST_MAX_FDS; x++) {
struct ast_frame *f;
@@ -2026,7 +2026,7 @@ static void *do_parking_thread(void *ignore)
notify_metermaids(pt->parkingexten, parking_con);
} else
ast_log(LOG_WARNING, "Whoa, no parking context?\n");
- free(pt);
+ ast_free(pt);
break;
} else {
/*! \todo XXX Maybe we could do something with packets, like dial "0" for operator or something XXX */
@@ -2158,7 +2158,7 @@ static int park_exec(struct ast_channel *chan, void *data)
S_OR(pu->chan->cid.cid_name, "<unknown>")
);
- free(pu);
+ ast_free(pu);
}
/* JK02: it helps to answer the channel if not already up */
if (chan->_state != AST_STATE_UP)
diff --git a/res/res_indications.c b/res/res_indications.c
index d149e21ba..1a8aafc76 100644
--- a/res/res_indications.c
+++ b/res/res_indications.c
@@ -100,7 +100,7 @@ static int handle_add_indication(int fd, int argc, char *argv[])
ast_copy_string(tz->country,argv[2],sizeof(tz->country));
if (ast_register_indication_country(tz)) {
ast_log(LOG_WARNING, "Unable to register new country\n");
- free(tz);
+ ast_free(tz);
return -1;
}
created_country = 1;
@@ -293,7 +293,7 @@ static int ind_load_module(void)
ast_copy_string(azone->alias, cxt, sizeof(azone->alias));
if (ast_register_indication_country(azone)) {
ast_log(LOG_WARNING, "Unable to register indication alias at line %d.\n",v->lineno);
- free(tones);
+ ast_free(tones);
}
/* next item */
country = strsep(&c,",");
@@ -326,9 +326,9 @@ out: v = v->next;
if (tones->description[0] || tones->alias[0] || tones->tones) {
if (ast_register_indication_country(tones)) {
ast_log(LOG_WARNING, "Unable to register indication at line %d.\n",v->lineno);
- free(tones);
+ ast_free(tones);
}
- } else free(tones);
+ } else ast_free(tones);
cxt = ast_category_browse(cfg, cxt);
}
diff --git a/res/res_jabber.c b/res/res_jabber.c
index 5b88bf741..e2ecf659a 100644
--- a/res/res_jabber.c
+++ b/res/res_jabber.c
@@ -184,12 +184,12 @@ static void aji_client_destroy(struct aji_client *obj)
AST_LIST_LOCK(&obj->messages);
while ((tmp = AST_LIST_REMOVE_HEAD(&obj->messages, list))) {
if (tmp->from)
- free(tmp->from);
+ ast_free(tmp->from);
if (tmp->message)
- free(tmp->message);
+ ast_free(tmp->message);
}
AST_LIST_HEAD_DESTROY(&obj->messages);
- free(obj);
+ ast_free(obj);
}
/*!
@@ -203,11 +203,11 @@ static void aji_buddy_destroy(struct aji_buddy *obj)
while ((tmp = obj->resources)) {
obj->resources = obj->resources->next;
- free(tmp->description);
- free(tmp);
+ ast_free(tmp->description);
+ ast_free(tmp);
}
- free(obj);
+ ast_free(obj);
}
/*!
@@ -241,7 +241,7 @@ static struct aji_version *aji_find_version(char *node, char *version, ikspak *p
/* Specified version not found. Let's add it to
this node in our capabilities list */
if(!res) {
- res = (struct aji_version *)malloc(sizeof(struct aji_version));
+ res = ast_malloc(sizeof(*res));
if(!res) {
ast_log(LOG_ERROR, "Out of memory!\n");
return NULL;
@@ -258,12 +258,12 @@ static struct aji_version *aji_find_version(char *node, char *version, ikspak *p
}
/* Specified node not found. Let's add it our capabilities list */
if(!list) {
- list = (struct aji_capabilities *)malloc(sizeof(struct aji_capabilities));
+ list = ast_malloc(sizeof(*list));
if(!list) {
ast_log(LOG_ERROR, "Out of memory!\n");
return NULL;
}
- res = (struct aji_version *)malloc(sizeof(struct aji_version));
+ res = ast_malloc(sizeof(*res));
if(!res) {
ast_log(LOG_ERROR, "Out of memory!\n");
return NULL;
@@ -571,9 +571,9 @@ static int aji_act_hook(void *data, int type, iks *node)
iks_send(client->p, x);
iks_delete(x);
if (base64)
- free(base64);
+ ast_free(base64);
if (s)
- free(s);
+ ast_free(s);
} else {
ast_log(LOG_ERROR, "Out of memory.\n");
}
@@ -612,7 +612,7 @@ static int aji_act_hook(void *data, int type, iks *node)
asprintf(&handshake, "<handshake>%s</handshake>", shasum);
if (handshake) {
iks_send_raw(client->p, handshake);
- free(handshake);
+ ast_free(handshake);
handshake = NULL;
}
client->state = AJI_CONNECTING;
@@ -1113,7 +1113,7 @@ static void aji_handle_message(struct aji_client *client, ikspak *pak)
struct aji_message *insert, *tmp;
int flag = 0;
- if (!(insert = ast_calloc(1, sizeof(struct aji_message))))
+ if (!(insert = ast_calloc(1, sizeof(*insert))))
return;
time(&insert->arrived);
if (iks_find_cdata(pak->x, "body"))
@@ -1127,16 +1127,16 @@ static void aji_handle_message(struct aji_client *client, ikspak *pak)
if (flag) {
AST_LIST_REMOVE_CURRENT(&client->messages, list);
if (tmp->from)
- free(tmp->from);
+ ast_free(tmp->from);
if (tmp->message)
- free(tmp->message);
+ ast_free(tmp->message);
} else if (difftime(time(NULL), tmp->arrived) >= client->message_timeout) {
flag = 1;
AST_LIST_REMOVE_CURRENT(&client->messages, list);
if (tmp->from)
- free(tmp->from);
+ ast_free(tmp->from);
if (tmp->message)
- free(tmp->message);
+ ast_free(tmp->message);
}
}
AST_LIST_TRAVERSE_SAFE_END;
@@ -1173,7 +1173,7 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
while (tmp) {
if (!strcasecmp(tmp->resource, pak->from->resource)) {
tmp->status = status;
- if (tmp->description) free(tmp->description);
+ if (tmp->description) ast_free(tmp->description);
tmp->description = descrip;
found = tmp;
if (status == 6) { /* Sign off Destroy resource */
@@ -1190,7 +1190,7 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
else
buddy->resources = NULL;
}
- free(found);
+ ast_free(found);
found = NULL;
break;
}
@@ -1230,8 +1230,7 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
}
if (!found && status != 6) {
- found = (struct aji_resource *) malloc(sizeof(struct aji_resource));
- memset(found, 0, sizeof(struct aji_resource));
+ found = ast_calloc(1, sizeof(*found));
if (!found) {
ast_log(LOG_ERROR, "Out of memory!\n");
@@ -1736,12 +1735,11 @@ static int aji_filter_roster(void *data, ikspak *pak)
});
if (!flag) {
- buddy = (struct aji_buddy *) malloc(sizeof(struct aji_buddy));
+ buddy = ast_calloc(1, sizeof(*buddy));
if (!buddy) {
ast_log(LOG_WARNING, "Out of memory\n");
return 0;
}
- memset(buddy, 0, sizeof(struct aji_buddy));
ASTOBJ_INIT(buddy);
ASTOBJ_WRLOCK(buddy);
ast_copy_string(buddy->name, iks_find_attrib(x, "jid"), sizeof(buddy->name));
@@ -2064,12 +2062,11 @@ static int aji_create_client(char *label, struct ast_variable *var, int debug)
client = ASTOBJ_CONTAINER_FIND(&clients,label);
if (!client) {
flag = 1;
- client = (struct aji_client *) malloc(sizeof(struct aji_client));
+ client = ast_calloc(1, sizeof(*client));
if (!client) {
ast_log(LOG_ERROR, "Out of memory!\n");
return 0;
}
- memset(client, 0, sizeof(struct aji_client));
ASTOBJ_INIT(client);
ASTOBJ_WRLOCK(client);
ASTOBJ_CONTAINER_INIT(&client->buddies);
@@ -2161,7 +2158,7 @@ static int aji_create_client(char *label, struct ast_variable *var, int debug)
asprintf(&resource, "%s/asterisk", client->user);
if (resource) {
client->jid = iks_id_new(client->stack, resource);
- free(resource);
+ ast_free(resource);
}
} else
client->jid = iks_id_new(client->stack, client->user);
@@ -2178,7 +2175,7 @@ static int aji_create_client(char *label, struct ast_variable *var, int debug)
asprintf(&resource, "%s/asterisk", client->user);
if (resource) {
client->jid = iks_id_new(client->stack, resource);
- free(resource);
+ ast_free(resource);
}
} else
client->jid = iks_id_new(client->stack, client->user);
@@ -2202,12 +2199,11 @@ static int aji_create_transport(char *label, struct aji_client *client)
buddy = ASTOBJ_CONTAINER_FIND(&client->buddies,label);
if (!buddy) {
- buddy = malloc(sizeof(struct aji_buddy));
+ buddy = ast_calloc(1, sizeof(*buddy));
if(!buddy) {
ast_log(LOG_WARNING, "Out of memory\n");
return 0;
}
- memset(buddy, 0, sizeof(struct aji_buddy));
ASTOBJ_INIT(buddy);
}
ASTOBJ_WRLOCK(buddy);
@@ -2252,12 +2248,11 @@ static int aji_create_buddy(char *label, struct aji_client *client)
buddy = ASTOBJ_CONTAINER_FIND(&client->buddies,label);
if (!buddy) {
flag = 1;
- buddy = malloc(sizeof(struct aji_buddy));
+ buddy = ast_calloc(1, sizeof(*buddy));
if(!buddy) {
ast_log(LOG_WARNING, "Out of memory\n");
return 0;
}
- memset(buddy, 0, sizeof(struct aji_buddy));
ASTOBJ_INIT(buddy);
}
ASTOBJ_WRLOCK(buddy);
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 7b69b6043..5bff1b1ff 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -156,7 +156,7 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec,
if (directory) {
char *name = strdup(fname_base);
snprintf(tmp, sizeof(tmp), "mkdir -p \"%s\"",dirname(name));
- free(name);
+ ast_free(name);
ast_safe_system(tmp);
}
snprintf(monitor->read_filename, FILENAME_MAX, "%s/%s-in",
@@ -200,7 +200,7 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec,
O_CREAT|O_TRUNC|O_WRONLY, 0, AST_FILE_MODE))) {
ast_log(LOG_WARNING, "Could not create file %s\n",
monitor->read_filename);
- free(monitor);
+ ast_free(monitor);
UNLOCK_IF_NEEDED(chan, need_lock);
return -1;
}
@@ -213,7 +213,7 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec,
ast_log(LOG_WARNING, "Could not create file %s\n",
monitor->write_filename);
ast_closestream(monitor->read_stream);
- free(monitor);
+ ast_free(monitor);
UNLOCK_IF_NEEDED(chan, need_lock);
return -1;
}
@@ -321,8 +321,8 @@ int ast_monitor_stop(struct ast_channel *chan, int need_lock)
ast_log(LOG_WARNING, "Execute of %s failed.\n",tmp);
}
- free(chan->monitor->format);
- free(chan->monitor);
+ ast_free(chan->monitor->format);
+ ast_free(chan->monitor);
chan->monitor = NULL;
}
@@ -371,7 +371,7 @@ int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, i
if (directory) {
char *name = strdup(fname_base);
snprintf(tmp, sizeof(tmp), "mkdir -p %s",dirname(name));
- free(name);
+ ast_free(name);
ast_safe_system(tmp);
}
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index ec049482c..22e44302f 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -175,7 +175,7 @@ static void ast_moh_free_class(struct mohclass **mohclass)
int i;
while ((member = AST_LIST_REMOVE_HEAD(&class->members, list)))
- free(member);
+ ast_free(member);
if (class->thread) {
pthread_cancel(class->thread);
@@ -184,11 +184,11 @@ static void ast_moh_free_class(struct mohclass **mohclass)
if (class->filearray) {
for (i = 0; i < class->total_files; i++)
- free(class->filearray[i]);
- free(class->filearray);
+ ast_free(class->filearray[i]);
+ ast_free(class->filearray);
}
- free(class);
+ ast_free(class);
*mohclass = NULL;
}
@@ -680,7 +680,7 @@ static struct mohdata *mohalloc(struct mohclass *cl)
if (pipe(moh->pipe)) {
ast_log(LOG_WARNING, "Failed to create pipe: %s\n", strerror(errno));
- free(moh);
+ ast_free(moh);
return NULL;
}
@@ -712,7 +712,7 @@ static void moh_release(struct ast_channel *chan, void *data)
close(moh->pipe[0]);
close(moh->pipe[1]);
oldwfmt = moh->origwfmt;
- free(moh);
+ ast_free(moh);
if (chan) {
if (oldwfmt && ast_set_write_format(chan, oldwfmt))
ast_log(LOG_WARNING, "Unable to restore channel '%s' to format %s\n", chan->name, ast_getformatname(oldwfmt));
@@ -819,7 +819,7 @@ static int moh_scan_files(struct mohclass *class) {
}
for (i = 0; i < class->total_files; i++)
- free(class->filearray[i]);
+ ast_free(class->filearray[i]);
class->total_files = 0;
dirnamelen = strlen(class->dir) + 2;
@@ -880,7 +880,7 @@ static int moh_register(struct mohclass *moh, int reload)
} else {
ast_log(LOG_WARNING, "Music on Hold class '%s' already exists\n", moh->name);
}
- free(moh);
+ ast_free(moh);
AST_RWLIST_UNLOCK(&mohclasses);
return -1;
}
@@ -944,7 +944,7 @@ static int moh_register(struct mohclass *moh, int reload)
static void local_ast_moh_cleanup(struct ast_channel *chan)
{
if (chan->music_state) {
- free(chan->music_state);
+ ast_free(chan->music_state);
chan->music_state = NULL;
}
}
@@ -1061,18 +1061,18 @@ static int load_moh_classes(int reload)
strcpy(class->dir, "nodir");
} else {
ast_log(LOG_WARNING, "A directory must be specified for class '%s'!\n", class->name);
- free(class);
+ ast_free(class);
continue;
}
}
if (ast_strlen_zero(class->mode)) {
ast_log(LOG_WARNING, "A mode must be specified for class '%s'!\n", class->name);
- free(class);
+ ast_free(class);
continue;
}
if (ast_strlen_zero(class->args) && !strcasecmp(class->mode, "custom")) {
ast_log(LOG_WARNING, "An application must be specified for class '%s'!\n", class->name);
- free(class);
+ ast_free(class);
continue;
}
diff --git a/res/res_odbc.c b/res/res_odbc.c
index 735bc98a7..36b5d116d 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -437,7 +437,7 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
if (odbc_obj_connect(obj) == ODBC_FAIL) {
ast_log(LOG_WARNING, "Failed to connect to %s\n", name);
ast_mutex_destroy(&obj->lock);
- free(obj);
+ ast_free(obj);
obj = NULL;
} else {
AST_LIST_INSERT_HEAD(&class->odbc_obj, obj, list);
@@ -657,12 +657,12 @@ static int reload(void)
AST_LIST_REMOVE_CURRENT(&(class->odbc_obj), list);
odbc_obj_disconnect(current);
ast_mutex_destroy(&current->lock);
- free(current);
+ ast_free(current);
}
AST_LIST_TRAVERSE_SAFE_END;
AST_LIST_REMOVE_CURRENT(&odbc_list, list);
- free(class);
+ ast_free(class);
}
}
AST_LIST_TRAVERSE_SAFE_END;
diff --git a/res/res_smdi.c b/res/res_smdi.c
index d84239713..f3d695408 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -476,13 +476,13 @@ static void *smdi_read(void *iface_p)
/*! \brief ast_smdi_md_message destructor. */
void ast_smdi_md_message_destroy(struct ast_smdi_md_message *msg)
{
- free(msg);
+ ast_free(msg);
}
/*! \brief ast_smdi_mwi_message destructor. */
void ast_smdi_mwi_message_destroy(struct ast_smdi_mwi_message *msg)
{
- free(msg);
+ ast_free(msg);
}
/*! \brief ast_smdi_interface destructor. */
@@ -502,7 +502,7 @@ void ast_smdi_interface_destroy(struct ast_smdi_interface *iface)
ASTOBJ_CONTAINER_DESTROYALL(&iface->mwi_q, ast_smdi_mwi_message_destroy);
ASTOBJ_CONTAINER_DESTROY(&iface->md_q);
ASTOBJ_CONTAINER_DESTROY(&iface->mwi_q);
- free(iface);
+ ast_free(iface);
ast_module_unref(ast_module_info->self);
}
diff --git a/res/res_speech.c b/res/res_speech.c
index 960c7f42c..67dce81cf 100644
--- a/res/res_speech.c
+++ b/res/res_speech.c
@@ -105,16 +105,16 @@ int ast_speech_results_free(struct ast_speech_result *result)
prev_result = current_result;
/* Deallocate what we can */
if (current_result->text != NULL) {
- free(current_result->text);
+ ast_free(current_result->text);
current_result->text = NULL;
}
if (current_result->grammar != NULL) {
- free(current_result->grammar);
+ ast_free(current_result->grammar);
current_result->grammar = NULL;
}
/* Move on and then free ourselves */
current_result = current_result->next;
- free(prev_result);
+ ast_free(prev_result);
prev_result = NULL;
}
@@ -187,7 +187,7 @@ struct ast_speech *ast_speech_new(char *engine_name, int format)
/* Pass ourselves to the engine so they can set us up some more and if they error out then do not create a structure */
if (engine->create(new_speech)) {
ast_mutex_destroy(&new_speech->lock);
- free(new_speech);
+ ast_free(new_speech);
new_speech = NULL;
}
@@ -211,10 +211,10 @@ int ast_speech_destroy(struct ast_speech *speech)
/* If a processing sound is set - free the memory used by it */
if (speech->processing_sound)
- free(speech->processing_sound);
+ ast_free(speech->processing_sound);
/* Aloha we are done */
- free(speech);
+ ast_free(speech);
return res;
}