Index: res/res_jabber.c
===================================================================
--- res/res_jabber.c (revision 67164)
+++ res/res_jabber.c (working copy)
@@ -184,12 +184,12 @@
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 @@
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 @@
/* 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 @@
}
/* 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 @@
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 @@
asprintf(&handshake, "%s", shasum);
if (handshake) {
iks_send_raw(client->p, handshake);
- free(handshake);
+ ast_free(handshake);
handshake = NULL;
}
client->state = AJI_CONNECTING;
@@ -1113,7 +1113,7 @@
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 @@
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 @@
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 @@
else
buddy->resources = NULL;
}
- free(found);
+ ast_free(found);
found = NULL;
break;
}
@@ -1230,8 +1230,7 @@
}
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 @@
});
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 @@
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 @@
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 @@
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 @@
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 @@
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);
Index: res/res_config_sqlite.c
===================================================================
--- res/res_config_sqlite.c (revision 67164)
+++ res/res_config_sqlite.c (working copy)
@@ -593,7 +593,7 @@
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 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 @@
if (error) {
ast_log(LOG_ERROR, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
return 1;
}
@@ -711,7 +711,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
}
- 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 @@
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 @@
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 @@
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 @@
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 @@
}
}
- 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 @@
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 @@
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 @@
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 @@
}
}
- 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 @@
if (error) {
ast_log(LOG_WARNING, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
}
return rows_num;
@@ -1239,7 +1239,7 @@
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 @@
*/
if (error != SQLITE_ERROR) {
ast_log(LOG_ERROR, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
unload_module();
return 1;
}
@@ -1270,7 +1270,7 @@
if (error) {
ast_log(LOG_ERROR, "%s\n", errormsg);
- free(errormsg);
+ ast_free(errormsg);
unload_module();
return 1;
}
Index: res/res_monitor.c
===================================================================
--- res/res_monitor.c (revision 67164)
+++ res/res_monitor.c (working copy)
@@ -156,7 +156,7 @@
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 @@
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 @@
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 @@
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 @@
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);
}
Index: res/res_smdi.c
===================================================================
--- res/res_smdi.c (revision 67164)
+++ res/res_smdi.c (working copy)
@@ -476,13 +476,13 @@
/*! \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 @@
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);
}
Index: res/res_agi.c
===================================================================
--- res/res_agi.c (revision 67164)
+++ res/res_agi.c (working copy)
@@ -130,7 +130,7 @@
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 @@
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");
}
Index: res/res_indications.c
===================================================================
--- res/res_indications.c (revision 67164)
+++ res/res_indications.c (working copy)
@@ -100,7 +100,7 @@
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 @@
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 @@
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);
}
Index: res/res_speech.c
===================================================================
--- res/res_speech.c (revision 67164)
+++ res/res_speech.c (working copy)
@@ -105,16 +105,16 @@
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 @@
/* 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 @@
/* 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;
}
Index: res/res_odbc.c
===================================================================
--- res/res_odbc.c (revision 67164)
+++ res/res_odbc.c (working copy)
@@ -437,7 +437,7 @@
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 @@
AST_LIST_REMOVE_CURRENT(&(class->odbc_obj), list);
odbc_obj_disconnect(current);
ast_mutex_destroy(¤t->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;
Index: res/res_config_pgsql.c
===================================================================
--- res/res_config_pgsql.c (revision 67164)
+++ res/res_config_pgsql.c (working copy)
@@ -193,7 +193,7 @@
}
}
}
- 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 @@
}
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 @@
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);
Index: res/res_features.c
===================================================================
--- res/res_features.c (revision 67164)
+++ res/res_features.c (working copy)
@@ -287,7 +287,7 @@
ast_hangup(tobj->peer);
}
- free(tobj);
+ ast_free(tobj);
return NULL;
}
@@ -375,7 +375,7 @@
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 @@
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 @@
return NULL;
if (ast_string_field_init(fg, 128)) {
- free(fg);
+ ast_free(fg);
return NULL;
}
@@ -1093,7 +1093,7 @@
return;
if (ast_string_field_init(fge, 128)) {
- free(fge);
+ ast_free(fge);
return;
}
@@ -1127,7 +1127,7 @@
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 @@
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 @@
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 @@
} 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 @@
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 @@
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 @@
S_OR(pu->chan->cid.cid_name, "")
);
- free(pu);
+ ast_free(pu);
}
/* JK02: it helps to answer the channel if not already up */
if (chan->_state != AST_STATE_UP)
Index: res/res_musiconhold.c
===================================================================
--- res/res_musiconhold.c (revision 67164)
+++ res/res_musiconhold.c (working copy)
@@ -175,7 +175,7 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
} 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 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 @@
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;
}