mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 16:21:01 +00:00
Change some uses of free() to ast_free(). (No functional differences.)
(closes issue #11138) Reported by: eliel Patches: pbx_dundi.c.patch uploaded by eliel (license 64) chan_sip.c.patch uploaded by eliel (license 64) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88077 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -17490,7 +17490,7 @@ static void add_peer_mailboxes(struct sip_peer *peer, const char *value)
|
|||||||
|
|
||||||
strsep(&context, "@");
|
strsep(&context, "@");
|
||||||
if (ast_strlen_zero(mbox)) {
|
if (ast_strlen_zero(mbox)) {
|
||||||
free(mailbox);
|
ast_free(mailbox);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mailbox->mailbox = ast_strdup(mbox);
|
mailbox->mailbox = ast_strdup(mbox);
|
||||||
|
@@ -679,7 +679,7 @@ static void *dundi_lookup_thread(void *data)
|
|||||||
st->trans->thread = 0;
|
st->trans->thread = 0;
|
||||||
}
|
}
|
||||||
AST_LIST_UNLOCK(&peers);
|
AST_LIST_UNLOCK(&peers);
|
||||||
free(st);
|
ast_free(st);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,7 +712,7 @@ static void *dundi_precache_thread(void *data)
|
|||||||
st->trans->thread = 0;
|
st->trans->thread = 0;
|
||||||
}
|
}
|
||||||
AST_LIST_UNLOCK(&peers);
|
AST_LIST_UNLOCK(&peers);
|
||||||
free(st);
|
ast_free(st);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,7 +772,7 @@ static void *dundi_query_thread(void *data)
|
|||||||
st->trans->thread = 0;
|
st->trans->thread = 0;
|
||||||
}
|
}
|
||||||
AST_LIST_UNLOCK(&peers);
|
AST_LIST_UNLOCK(&peers);
|
||||||
free(st);
|
ast_free(st);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,7 +818,7 @@ static int dundi_answer_entity(struct dundi_transaction *trans, struct dundi_ies
|
|||||||
struct dundi_ie_data ied = { 0, };
|
struct dundi_ie_data ied = { 0, };
|
||||||
trans->thread = 0;
|
trans->thread = 0;
|
||||||
ast_log(LOG_WARNING, "Unable to create thread!\n");
|
ast_log(LOG_WARNING, "Unable to create thread!\n");
|
||||||
free(st);
|
ast_free(st);
|
||||||
dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
|
dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
|
||||||
dundi_send(trans, DUNDI_COMMAND_EIDRESPONSE, 0, 1, &ied);
|
dundi_send(trans, DUNDI_COMMAND_EIDRESPONSE, 0, 1, &ied);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1042,7 +1042,7 @@ static int dundi_prop_precache(struct dundi_transaction *trans, struct dundi_ies
|
|||||||
if (ast_pthread_create_detached(&lookupthread, NULL, dundi_precache_thread, st)) {
|
if (ast_pthread_create_detached(&lookupthread, NULL, dundi_precache_thread, st)) {
|
||||||
trans->thread = 0;
|
trans->thread = 0;
|
||||||
ast_log(LOG_WARNING, "Unable to create thread!\n");
|
ast_log(LOG_WARNING, "Unable to create thread!\n");
|
||||||
free(st);
|
ast_free(st);
|
||||||
memset(&ied, 0, sizeof(ied));
|
memset(&ied, 0, sizeof(ied));
|
||||||
dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
|
dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
|
||||||
dundi_send(trans, DUNDI_COMMAND_PRECACHERP, 0, 1, &ied);
|
dundi_send(trans, DUNDI_COMMAND_PRECACHERP, 0, 1, &ied);
|
||||||
@@ -1126,7 +1126,7 @@ static int dundi_answer_query(struct dundi_transaction *trans, struct dundi_ies
|
|||||||
if (ast_pthread_create_detached(&lookupthread, NULL, dundi_lookup_thread, st)) {
|
if (ast_pthread_create_detached(&lookupthread, NULL, dundi_lookup_thread, st)) {
|
||||||
trans->thread = 0;
|
trans->thread = 0;
|
||||||
ast_log(LOG_WARNING, "Unable to create thread!\n");
|
ast_log(LOG_WARNING, "Unable to create thread!\n");
|
||||||
free(st);
|
ast_free(st);
|
||||||
memset(&ied, 0, sizeof(ied));
|
memset(&ied, 0, sizeof(ied));
|
||||||
dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
|
dundi_ie_append_cause(&ied, DUNDI_IE_CAUSE, DUNDI_CAUSE_GENERAL, "Out of threads");
|
||||||
dundi_send(trans, DUNDI_COMMAND_DPRESPONSE, 0, 1, &ied);
|
dundi_send(trans, DUNDI_COMMAND_DPRESPONSE, 0, 1, &ied);
|
||||||
@@ -1975,7 +1975,7 @@ static void destroy_packets(struct packetlist *p)
|
|||||||
while ((pack = AST_LIST_REMOVE_HEAD(p, list))) {
|
while ((pack = AST_LIST_REMOVE_HEAD(p, list))) {
|
||||||
if (pack->retransid > -1)
|
if (pack->retransid > -1)
|
||||||
ast_sched_del(sched, pack->retransid);
|
ast_sched_del(sched, pack->retransid);
|
||||||
free(pack);
|
ast_free(pack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2199,7 +2199,7 @@ static void *process_precache(void *ign)
|
|||||||
if (!qe->expiration) {
|
if (!qe->expiration) {
|
||||||
/* Gone... Remove... */
|
/* Gone... Remove... */
|
||||||
AST_LIST_REMOVE_HEAD(&pcq, list);
|
AST_LIST_REMOVE_HEAD(&pcq, list);
|
||||||
free(qe);
|
ast_free(qe);
|
||||||
} else if (qe->expiration < now) {
|
} else if (qe->expiration < now) {
|
||||||
/* Process this entry */
|
/* Process this entry */
|
||||||
qe->expiration = 0;
|
qe->expiration = 0;
|
||||||
@@ -2297,7 +2297,7 @@ static char *dundi_flush(struct ast_cli_entry *e, int cmd, struct ast_cli_args *
|
|||||||
AST_LIST_TRAVERSE(&peers, p, list) {
|
AST_LIST_TRAVERSE(&peers, p, list) {
|
||||||
for (x = 0;x < DUNDI_TIMING_HISTORY; x++) {
|
for (x = 0;x < DUNDI_TIMING_HISTORY; x++) {
|
||||||
if (p->lookups[x])
|
if (p->lookups[x])
|
||||||
free(p->lookups[x]);
|
ast_free(p->lookups[x]);
|
||||||
p->lookups[x] = NULL;
|
p->lookups[x] = NULL;
|
||||||
p->lookuptimes[x] = 0;
|
p->lookuptimes[x] = 0;
|
||||||
}
|
}
|
||||||
@@ -2937,7 +2937,7 @@ static void destroy_packet(struct dundi_packet *pack, int needfree)
|
|||||||
if (pack->retransid > -1)
|
if (pack->retransid > -1)
|
||||||
ast_sched_del(sched, pack->retransid);
|
ast_sched_del(sched, pack->retransid);
|
||||||
if (needfree)
|
if (needfree)
|
||||||
free(pack);
|
ast_free(pack);
|
||||||
else
|
else
|
||||||
pack->retransid = -1;
|
pack->retransid = -1;
|
||||||
}
|
}
|
||||||
@@ -2978,7 +2978,7 @@ static void destroy_trans(struct dundi_transaction *trans, int fromtimeout)
|
|||||||
peer->avgms = 0;
|
peer->avgms = 0;
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
if (peer->lookups[DUNDI_TIMING_HISTORY-1])
|
if (peer->lookups[DUNDI_TIMING_HISTORY-1])
|
||||||
free(peer->lookups[DUNDI_TIMING_HISTORY-1]);
|
ast_free(peer->lookups[DUNDI_TIMING_HISTORY-1]);
|
||||||
for (x=DUNDI_TIMING_HISTORY-1;x>0;x--) {
|
for (x=DUNDI_TIMING_HISTORY-1;x>0;x--) {
|
||||||
peer->lookuptimes[x] = peer->lookuptimes[x-1];
|
peer->lookuptimes[x] = peer->lookuptimes[x-1];
|
||||||
peer->lookups[x] = peer->lookups[x-1];
|
peer->lookups[x] = peer->lookups[x-1];
|
||||||
@@ -3022,7 +3022,7 @@ static void destroy_trans(struct dundi_transaction *trans, int fromtimeout)
|
|||||||
/* If used by a thread, mark as dead and be done */
|
/* If used by a thread, mark as dead and be done */
|
||||||
ast_set_flag(trans, FLAG_DEAD);
|
ast_set_flag(trans, FLAG_DEAD);
|
||||||
} else
|
} else
|
||||||
free(trans);
|
ast_free(trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dundi_rexmit(const void *data)
|
static int dundi_rexmit(const void *data)
|
||||||
@@ -3113,7 +3113,7 @@ static int dundi_send(struct dundi_transaction *trans, int cmdresp, int flags, i
|
|||||||
ast_log(LOG_NOTICE, "Failed to send packet to '%s'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &trans->them_eid));
|
ast_log(LOG_NOTICE, "Failed to send packet to '%s'\n", dundi_eid_to_str(eid_str, sizeof(eid_str), &trans->them_eid));
|
||||||
|
|
||||||
if (cmdresp == DUNDI_COMMAND_ACK)
|
if (cmdresp == DUNDI_COMMAND_ACK)
|
||||||
free(pack);
|
ast_free(pack);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@@ -3958,7 +3958,7 @@ struct dundi_result_datastore {
|
|||||||
|
|
||||||
static void drds_destroy(struct dundi_result_datastore *drds)
|
static void drds_destroy(struct dundi_result_datastore *drds)
|
||||||
{
|
{
|
||||||
free(drds);
|
ast_free(drds);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drds_destroy_cb(void *data)
|
static void drds_destroy_cb(void *data)
|
||||||
@@ -4165,7 +4165,7 @@ static void destroy_permissions(struct permissionlist *permlist)
|
|||||||
struct permission *perm;
|
struct permission *perm;
|
||||||
|
|
||||||
while ((perm = AST_LIST_REMOVE_HEAD(permlist, list)))
|
while ((perm = AST_LIST_REMOVE_HEAD(permlist, list)))
|
||||||
free(perm);
|
ast_free(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroy_peer(struct dundi_peer *peer)
|
static void destroy_peer(struct dundi_peer *peer)
|
||||||
@@ -4178,14 +4178,14 @@ static void destroy_peer(struct dundi_peer *peer)
|
|||||||
ast_sched_del(sched, peer->qualifyid);
|
ast_sched_del(sched, peer->qualifyid);
|
||||||
destroy_permissions(&peer->permit);
|
destroy_permissions(&peer->permit);
|
||||||
destroy_permissions(&peer->include);
|
destroy_permissions(&peer->include);
|
||||||
free(peer);
|
ast_free(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroy_map(struct dundi_mapping *map)
|
static void destroy_map(struct dundi_mapping *map)
|
||||||
{
|
{
|
||||||
if (map->weightstr)
|
if (map->weightstr)
|
||||||
free(map->weightstr);
|
ast_free(map->weightstr);
|
||||||
free(map);
|
ast_free(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prune_peers(void)
|
static void prune_peers(void)
|
||||||
|
Reference in New Issue
Block a user