Customer reported unexpected behavior after incoming call with redirection number information element. The problem is caused by destruction of internal structures of libc and arrives not on every system but
on system of interest (Debian Lenny) confirmed with asterisk 1.4 and 1.6. Code review shhown that i->owner->cid.cid_rdnis can be changed by ast_(strdup,free) and by standard C library functions at same time. To resolve this and future problems generally change malloc -> ast_malloc, strdup -> as_strdup and free -> ast_free.master
parent
30d7131076
commit
999b9e306b
30
chan_capi.c
30
chan_capi.c
|
@ -2307,10 +2307,8 @@ static struct ast_channel *capi_new(struct capi_pvt *i, int state, const char *l
|
|||
tmp->connected.id.number.str = ast_strdup(i->cid);
|
||||
tmp->connected.id.number.plan = i->cid_ton;
|
||||
#else
|
||||
if (tmp->cid.cid_num) {
|
||||
free(tmp->cid.cid_num);
|
||||
}
|
||||
tmp->cid.cid_num = strdup(i->cid);
|
||||
ast_free(tmp->cid.cid_num);
|
||||
tmp->cid.cid_num = ast_strdup(i->cid);
|
||||
#endif
|
||||
}
|
||||
if (!ast_strlen_zero(i->dnid)) {
|
||||
|
@ -2904,7 +2902,7 @@ static int pbx_capi_receive_fax(struct ast_channel *c, char *data)
|
|||
return -1;
|
||||
}
|
||||
|
||||
ldata_mem = ldata = strdup(data);
|
||||
ldata_mem = ldata = ast_strdup(data);
|
||||
if (!ldata_mem) {
|
||||
cc_log(LOG_WARNING, CC_MESSAGE_NAME " out of memory\n");
|
||||
capi_remove_nullif(i);
|
||||
|
@ -2928,7 +2926,7 @@ static int pbx_capi_receive_fax(struct ast_channel *c, char *data)
|
|||
ldata++;
|
||||
}
|
||||
|
||||
free(ldata_mem);
|
||||
ast_free(ldata_mem);
|
||||
|
||||
if ((force_extended != 0) && (capi_controllers[i->controller]->fax_t30_extended == 0)) {
|
||||
force_extended = 0;
|
||||
|
@ -3362,7 +3360,7 @@ static int pbx_capi_send_fax(struct ast_channel *c, char *data)
|
|||
return -1;
|
||||
}
|
||||
|
||||
ldata_mem = ldata = strdup(data);
|
||||
ldata_mem = ldata = ast_strdup(data);
|
||||
if (!ldata_mem) {
|
||||
cc_log(LOG_WARNING, CC_MESSAGE_NAME " out of memory\n");
|
||||
capi_remove_nullif(i);
|
||||
|
@ -3386,7 +3384,7 @@ static int pbx_capi_send_fax(struct ast_channel *c, char *data)
|
|||
ldata++;
|
||||
}
|
||||
|
||||
free(ldata_mem);
|
||||
ast_free(ldata_mem);
|
||||
|
||||
if ((force_extended != 0) && (capi_controllers[i->controller]->fax_t30_extended == 0)) {
|
||||
force_extended = 0;
|
||||
|
@ -3963,10 +3961,8 @@ static void capidev_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsig
|
|||
ast_channel_set_redirecting(i->owner, &redirecting, &update_redirecting);
|
||||
}
|
||||
#else
|
||||
if (i->owner->cid.cid_rdnis) {
|
||||
free(i->owner->cid.cid_rdnis);
|
||||
}
|
||||
i->owner->cid.cid_rdnis = strdup(p);
|
||||
ast_free(i->owner->cid.cid_rdnis);
|
||||
i->owner->cid.cid_rdnis = ast_strdup(p);
|
||||
#endif
|
||||
}
|
||||
capidev_sendback_info(i, CMSG);
|
||||
|
@ -7397,7 +7393,7 @@ int mkif(struct cc_capi_conf *conf)
|
|||
u_int16_t unit;
|
||||
|
||||
for (i = 0; i <= conf->devices; i++) {
|
||||
tmp = malloc(sizeof(struct capi_pvt));
|
||||
tmp = ast_malloc(sizeof(struct capi_pvt));
|
||||
if (!tmp) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -7449,7 +7445,7 @@ int mkif(struct cc_capi_conf *conf)
|
|||
|
||||
if ((unit > capi_num_controllers) ||
|
||||
(!(capi_controllers[unit]))) {
|
||||
free(tmp);
|
||||
ast_free(tmp);
|
||||
cc_verbose(2, 0, VERBOSE_PREFIX_3 "controller %d invalid, ignoring interface.\n",
|
||||
unit);
|
||||
return 0;
|
||||
|
@ -8109,7 +8105,7 @@ static int cc_init_capi(void)
|
|||
#else
|
||||
capi20_get_profile(controller, (unsigned char *)&profile);
|
||||
#endif
|
||||
cp = malloc(sizeof(struct cc_capi_controller));
|
||||
cp = ast_malloc(sizeof(struct cc_capi_controller));
|
||||
if (!cp) {
|
||||
cc_log(LOG_ERROR, "Error allocating memory for struct cc_capi_controller\n");
|
||||
return -1;
|
||||
|
@ -8590,7 +8586,7 @@ int unload_module(void)
|
|||
|
||||
for (controller = 1; controller <= CAPI_MAX_CONTROLLERS; controller++) {
|
||||
if (capi_controllers[controller])
|
||||
free(capi_controllers[controller]);
|
||||
ast_free(capi_controllers[controller]);
|
||||
}
|
||||
|
||||
i = capi_iflist;
|
||||
|
@ -8606,7 +8602,7 @@ int unload_module(void)
|
|||
ast_cond_destroy(&i->event_trigger);
|
||||
itmp = i;
|
||||
i = i->next;
|
||||
free(itmp);
|
||||
ast_free(itmp);
|
||||
}
|
||||
|
||||
cc_mutex_unlock(&iflock);
|
||||
|
|
|
@ -287,7 +287,7 @@ static void update_all_capi_mixers(unsigned int roomnumber)
|
|||
unsigned int PLCIS[overall_found];
|
||||
int i, j, nr;
|
||||
|
||||
segments = malloc (sizeof(*segments)*overall_found*nr_segments);
|
||||
segments = ast_malloc (sizeof(*segments)*overall_found*nr_segments);
|
||||
if (segments == 0) {
|
||||
cc_mutex_unlock(&chat_lock);
|
||||
return;
|
||||
|
@ -324,7 +324,7 @@ static void update_all_capi_mixers(unsigned int roomnumber)
|
|||
}
|
||||
}
|
||||
|
||||
free(segments);
|
||||
ast_free(segments);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,7 +349,7 @@ static void del_chat_member(struct capichat_s *room)
|
|||
}
|
||||
cc_verbose(3, 0, VERBOSE_PREFIX_3 "%s: removed chat member from room '%s' (%d)\n",
|
||||
room->i->vname, room->name, room->number);
|
||||
free(room);
|
||||
ast_free(room);
|
||||
}
|
||||
tmproom2 = tmproom;
|
||||
tmproom = tmproom->next;
|
||||
|
@ -369,7 +369,7 @@ static struct capichat_s *add_chat_member(char *roomname, struct capi_pvt *i, ro
|
|||
unsigned int roomnumber = 1;
|
||||
room_mode_t room_mode = RoomModeDefault;
|
||||
|
||||
room = malloc(sizeof(struct capichat_s));
|
||||
room = ast_malloc(sizeof(struct capichat_s));
|
||||
if (room == NULL) {
|
||||
cc_log(LOG_ERROR, "Unable to allocate chan_capi chat struct.\n");
|
||||
return NULL;
|
||||
|
|
|
@ -111,7 +111,7 @@ int pbx_capi_voicecommand(struct ast_channel *c, char *param)
|
|||
while ((cmd = pbx_capi_find_command (i, command[0])) != 0) {
|
||||
cc_verbose(2, 0, VERBOSE_PREFIX_4"%s: voicecommand:%s removed\n", i->vname, cmd->command_name);
|
||||
diva_q_remove (&i->channel_command_q, &cmd->link);
|
||||
free (cmd);
|
||||
ast_free (cmd);
|
||||
}
|
||||
cc_mutex_unlock(&i->lock);
|
||||
} else {
|
||||
|
@ -148,7 +148,7 @@ int pbx_capi_voicecommand(struct ast_channel *c, char *param)
|
|||
}
|
||||
}
|
||||
|
||||
cmd = malloc(sizeof(*cmd));
|
||||
cmd = ast_malloc(sizeof(*cmd));
|
||||
if (cmd == NULL) {
|
||||
cc_log(LOG_WARNING, CC_MESSAGE_NAME " can not allocate memory for voice command\n");
|
||||
return -1;
|
||||
|
@ -187,7 +187,7 @@ int pbx_capi_voicecommand(struct ast_channel *c, char *param)
|
|||
cc_mutex_unlock(&i->lock);
|
||||
|
||||
if (present_cmd != 0) {
|
||||
free (present_cmd);
|
||||
ast_free (present_cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ int pbx_capi_voicecommand_cleanup(struct capi_pvt *i)
|
|||
|
||||
while ((link = diva_q_get_head(&i->channel_command_q)) != NULL) {
|
||||
diva_q_remove(&i->channel_command_q, link);
|
||||
free(link);
|
||||
ast_free(link);
|
||||
}
|
||||
|
||||
i->channel_command_digit = 0;
|
||||
|
|
|
@ -190,7 +190,7 @@ struct rose_component {
|
|||
} while (0)
|
||||
|
||||
|
||||
#define free_null(x) { free(x); x = NULL; }
|
||||
#define free_null(x) { ast_free(x); x = NULL; }
|
||||
|
||||
/* Common QSIG structs */
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ unsigned int cc_qsig_asn197ade_get_pns(unsigned char *data, int *idx, struct asn
|
|||
|
||||
myidx += res;
|
||||
if (strlen(buf)) {
|
||||
ns->partyNumber = strdup(buf);
|
||||
ns->partyNumber = ast_strdup(buf);
|
||||
}
|
||||
|
||||
/* get screening indicator */
|
||||
|
@ -170,7 +170,7 @@ unsigned int cc_qsig_asn197ade_get_pns(unsigned char *data, int *idx, struct asn
|
|||
|
||||
myidx += res;
|
||||
if (strlen(buf)) {
|
||||
ns->partyNumber = strdup(buf);
|
||||
ns->partyNumber = ast_strdup(buf);
|
||||
}
|
||||
|
||||
/* get screening indicator */
|
||||
|
|
|
@ -222,7 +222,7 @@ unsigned char *cc_qsig_asn1_oid2str(unsigned char *data, int size)
|
|||
*s++ = 0;
|
||||
|
||||
s = buf;
|
||||
return (unsigned char *) strdup((char*)s);
|
||||
return (unsigned char *) ast_strdup((char*)s);
|
||||
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ signed int cc_qsig_identifyinvoke(struct cc_qsig_invokedata *invoke, int protoco
|
|||
oidstr = cc_qsig_asn1_oid2str(invoke->oid_bin, invoke->oid_len);
|
||||
if (oidstr) {
|
||||
cc_qsig_verbose( 1, VERBOSE_PREFIX_3 "QSIG: INVOKE OP (%s)\n", oidstr);
|
||||
free(oidstr);
|
||||
ast_free(oidstr);
|
||||
} else {
|
||||
cc_qsig_verbose( 1, VERBOSE_PREFIX_3 "QSIG: INVOKE OP (unknown - OID not displayable)\n");
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ signed int cc_qsig_identifyinvoke(struct cc_qsig_invokedata *invoke, int protoco
|
|||
oidstr = cc_qsig_asn1_oid2str(invoke->oid_bin, invoke->oid_len);
|
||||
if (oidstr) {
|
||||
cc_qsig_verbose( 1, VERBOSE_PREFIX_3 "QSIG: INVOKE OP (%s)\n", oidstr);
|
||||
free(oidstr);
|
||||
ast_free(oidstr);
|
||||
} else {
|
||||
cc_qsig_verbose( 1, VERBOSE_PREFIX_3 "QSIG: INVOKE OP (unknown - OID not displayable)\n");
|
||||
}
|
||||
|
@ -698,16 +698,16 @@ static void pbx_capi_qsig_handle_ctc(struct cc_qsig_invokedata *invoke, struct c
|
|||
switch (ii->state) {
|
||||
case CAPI_STATE_ALERTING:
|
||||
cc_qsig_verbose( 1, VERBOSE_PREFIX_3 "QSIG: peer is in state ALERTING, PATH REPLACE follows after CONNECT...\n");
|
||||
ii->qsig_data.pr_propose_cid = strdup("123"); /* HACK: need an dynamic ID */
|
||||
ii->qsig_data.pr_propose_pn = strdup(i->qsig_data.if_pr_propose_pn);
|
||||
ii->qsig_data.pr_propose_cid = ast_strdup("123"); /* HACK: need an dynamic ID */
|
||||
ii->qsig_data.pr_propose_pn = ast_strdup(i->qsig_data.if_pr_propose_pn);
|
||||
ii->qsig_data.pr_propose_doinboundbridge = 1;
|
||||
i->qsig_data.pr_propose_doinboundbridge = 1;
|
||||
i->qsig_data.partner_plci = ii->PLCI;
|
||||
break;
|
||||
case CAPI_STATE_CONNECTED:
|
||||
cc_qsig_verbose( 1, VERBOSE_PREFIX_3 "QSIG: peer is CONNECTED...\n");
|
||||
i->qsig_data.pr_propose_cid = strdup("123"); /* HACK: need an dynamic ID */
|
||||
i->qsig_data.pr_propose_pn = strdup(i->qsig_data.if_pr_propose_pn);
|
||||
i->qsig_data.pr_propose_cid = ast_strdup("123"); /* HACK: need an dynamic ID */
|
||||
i->qsig_data.pr_propose_pn = ast_strdup(i->qsig_data.if_pr_propose_pn);
|
||||
ii->qsig_data.pr_propose_doinboundbridge = 1;
|
||||
ii->qsig_data.partner_plci = i->PLCI;
|
||||
|
||||
|
@ -1351,15 +1351,15 @@ static void qsig_cleanup_channel(struct capi_pvt *i)
|
|||
i->qsig_data.pr_propose_sentback = 0;
|
||||
i->qsig_data.pr_propose_doinboundbridge = 0;
|
||||
if (i->qsig_data.pr_propose_cid) {
|
||||
free(i->qsig_data.pr_propose_cid);
|
||||
ast_free(i->qsig_data.pr_propose_cid);
|
||||
i->qsig_data.pr_propose_cid = NULL;
|
||||
}
|
||||
if (i->qsig_data.pr_propose_pn) {
|
||||
free(i->qsig_data.pr_propose_pn);
|
||||
ast_free(i->qsig_data.pr_propose_pn);
|
||||
i->qsig_data.pr_propose_pn = NULL;
|
||||
}
|
||||
if (i->qsig_data.dnameid) {
|
||||
free(i->qsig_data.dnameid);
|
||||
ast_free(i->qsig_data.dnameid);
|
||||
i->qsig_data.dnameid = NULL;
|
||||
}
|
||||
|
||||
|
@ -1528,8 +1528,8 @@ void pbx_capi_qsig_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsign
|
|||
ii->qsig_data.pr_propose_sentback = 1;
|
||||
} else { /* Path Replacement has to be sent back after Connect on second line */
|
||||
ii->qsig_data.pr_propose_sendback = 1;
|
||||
ii->qsig_data.pr_propose_cid = strdup(i->qsig_data.pr_propose_cid);
|
||||
ii->qsig_data.pr_propose_pn = strdup(i->qsig_data.pr_propose_pn);
|
||||
ii->qsig_data.pr_propose_cid = ast_strdup(i->qsig_data.pr_propose_cid);
|
||||
ii->qsig_data.pr_propose_pn = ast_strdup(i->qsig_data.pr_propose_pn);
|
||||
ii->qsig_data.pr_propose_active = 1;
|
||||
}
|
||||
} else
|
||||
|
@ -1537,9 +1537,9 @@ void pbx_capi_qsig_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsign
|
|||
|
||||
|
||||
|
||||
free(i->qsig_data.pr_propose_cid);
|
||||
ast_free(i->qsig_data.pr_propose_cid);
|
||||
i->qsig_data.pr_propose_cid = NULL;
|
||||
free(i->qsig_data.pr_propose_pn);
|
||||
ast_free(i->qsig_data.pr_propose_pn);
|
||||
i->qsig_data.pr_propose_pn = NULL;
|
||||
}
|
||||
|
||||
|
@ -1553,9 +1553,9 @@ void pbx_capi_qsig_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsign
|
|||
ast_channel_masquerade(ii->owner, chanx);
|
||||
}
|
||||
|
||||
free(i->qsig_data.pr_propose_cid);
|
||||
ast_free(i->qsig_data.pr_propose_cid);
|
||||
i->qsig_data.pr_propose_cid = NULL;
|
||||
free(i->qsig_data.pr_propose_pn);
|
||||
ast_free(i->qsig_data.pr_propose_pn);
|
||||
i->qsig_data.pr_propose_pn = NULL;
|
||||
}
|
||||
|
||||
|
@ -1612,9 +1612,9 @@ void pbx_capi_qsig_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsign
|
|||
);
|
||||
|
||||
i->qsig_data.pr_propose_sendback = 0;
|
||||
free(i->qsig_data.pr_propose_cid);
|
||||
ast_free(i->qsig_data.pr_propose_cid);
|
||||
i->qsig_data.pr_propose_cid = NULL;
|
||||
free(i->qsig_data.pr_propose_pn);
|
||||
ast_free(i->qsig_data.pr_propose_pn);
|
||||
i->qsig_data.pr_propose_pn = NULL;
|
||||
|
||||
i->qsig_data.pr_propose_sentback = 1;
|
||||
|
@ -1640,9 +1640,9 @@ void pbx_capi_qsig_handle_info_indication(_cmsg *CMSG, unsigned int PLCI, unsign
|
|||
"()(()()()s)", fac );
|
||||
|
||||
i->qsig_data.pr_propose_sendback = 0;
|
||||
free(i->qsig_data.pr_propose_cid);
|
||||
ast_free(i->qsig_data.pr_propose_cid);
|
||||
i->qsig_data.pr_propose_cid = NULL;
|
||||
free(i->qsig_data.pr_propose_pn);
|
||||
ast_free(i->qsig_data.pr_propose_pn);
|
||||
i->qsig_data.pr_propose_pn = NULL;
|
||||
|
||||
i->qsig_data.pr_propose_sentback = 1;
|
||||
|
|
|
@ -78,7 +78,7 @@ void cc_qsig_op_ecma_isdn_namepres(struct cc_qsig_invokedata *invoke, struct cap
|
|||
#ifdef CC_AST_HAS_VERSION_1_8
|
||||
ast_set_callerid(i->owner, NULL, callername, NULL);
|
||||
#else
|
||||
i->owner->cid.cid_name = strdup(callername); /* Save name to callerid */
|
||||
i->owner->cid.cid_name = ast_strdup(callername); /* Save name to callerid */
|
||||
#endif
|
||||
break;
|
||||
case 1: /* Called Name */
|
||||
|
@ -86,9 +86,9 @@ void cc_qsig_op_ecma_isdn_namepres(struct cc_qsig_invokedata *invoke, struct cap
|
|||
case 3: /* Busy Name */
|
||||
if (i->qsig_data.dnameid) { /* this facility may come more than once - if so, then update this value */
|
||||
cc_qsig_verbose( 1, VERBOSE_PREFIX_4 " * deleting previously received name.\n", nametype, namelength, callername);
|
||||
free(i->qsig_data.dnameid);
|
||||
ast_free(i->qsig_data.dnameid);
|
||||
}
|
||||
i->qsig_data.dnameid = strdup(callername); /* save name as destination in qsig specific fields */
|
||||
i->qsig_data.dnameid = ast_strdup(callername); /* save name as destination in qsig specific fields */
|
||||
/* there's no similarly field in asterisk */
|
||||
break;
|
||||
default:
|
||||
|
@ -403,11 +403,11 @@ void cc_qsig_encode_ecma_calltransfer(unsigned char * buf, unsigned int *idx, st
|
|||
icanswer = ccanswer[0] - 0x30;
|
||||
}
|
||||
} else {
|
||||
/* cid = strdup(i->owner->cid.cid_num);*/ /* Here we get the Asterisk extension */
|
||||
/* cid = ast_strdup(i->owner->cid.cid_num);*/ /* Here we get the Asterisk extension */
|
||||
if (info) { /* info is >0 on outbound channel (second facility) */
|
||||
struct capi_pvt *ii = capi_find_interface_by_plci(i->qsig_data.partner_plci);
|
||||
|
||||
cid = strdup(i->cid);
|
||||
cid = ast_strdup(i->cid);
|
||||
cidlen = strlen(cid);
|
||||
|
||||
if (ii) {
|
||||
|
@ -426,7 +426,7 @@ void cc_qsig_encode_ecma_calltransfer(unsigned char * buf, unsigned int *idx, st
|
|||
}
|
||||
} else { /* have to build first facility - send destination number back to inbound channel */
|
||||
struct capi_pvt *ii = capi_find_interface_by_plci(i->qsig_data.partner_plci);
|
||||
cid = strdup(ii->dnid);
|
||||
cid = ast_strdup(ii->dnid);
|
||||
cidlen = strlen(cid);
|
||||
|
||||
if (ii) {
|
||||
|
@ -490,7 +490,7 @@ void cc_qsig_encode_ecma_calltransfer(unsigned char * buf, unsigned int *idx, st
|
|||
cc_qsig_verbose( 0, VERBOSE_PREFIX_4 " * Sending QSIG_CT: %i->%s\n", info, cid);
|
||||
|
||||
if (cid)
|
||||
free(cid);
|
||||
ast_free(cid);
|
||||
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ unsigned int cc_qsig_decode_ecma_calltransfer(struct cc_qsig_invokedata *invoke,
|
|||
if (data[myidx] == ASN1_TC_APPLICATION) {
|
||||
myidx++;
|
||||
/* TODO: check size -> could be bigger than 256 bytes - MSB is set then */
|
||||
ctc->basicCallInfoElements = malloc(data[myidx]);
|
||||
ctc->basicCallInfoElements = ast_malloc(data[myidx]);
|
||||
if (ctc->basicCallInfoElements) {
|
||||
memcpy(ctc->basicCallInfoElements, &data[myidx+1], data[myidx] );
|
||||
} else {
|
||||
|
@ -577,7 +577,7 @@ unsigned int cc_qsig_decode_ecma_calltransfer(struct cc_qsig_invokedata *invoke,
|
|||
if (data[myidx] != ASN1_ENUMERATED) { /* Maybe we get an name (OPTIONAL) */
|
||||
myidx += cc_qsig_asn197no_get_name(ct_name, ASN197NO_NAME_STRSIZE+1, &namelength, &myidx, data );
|
||||
if (namelength)
|
||||
ctc->redirectionName = strdup(ct_name);
|
||||
ctc->redirectionName = ast_strdup(ct_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -729,8 +729,8 @@ void cc_qsig_op_ecma_isdn_prpropose(struct cc_qsig_invokedata *invoke, struct ca
|
|||
}
|
||||
|
||||
|
||||
i->qsig_data.pr_propose_cid = strdup(callid);
|
||||
i->qsig_data.pr_propose_pn = strdup(reroutingnr);
|
||||
i->qsig_data.pr_propose_cid = ast_strdup(callid);
|
||||
i->qsig_data.pr_propose_pn = ast_strdup(reroutingnr);
|
||||
|
||||
cc_qsig_verbose( 0, VERBOSE_PREFIX_4 " * Got QSIG_PATHREPLACEMENT_PROPOSE Call identity: %s, Party number: %s (%i)\n", callid, reroutingnr, temp);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ static void del_old_ccbsnr(void)
|
|||
} else {
|
||||
tmp->next = ccbsnr->next;
|
||||
}
|
||||
free(ccbsnr);
|
||||
ast_free(ccbsnr);
|
||||
break;
|
||||
}
|
||||
tmp = ccbsnr;
|
||||
|
@ -86,7 +86,7 @@ void cleanup_ccbsnr(void)
|
|||
while (ccbsnr) {
|
||||
tmp = ccbsnr;
|
||||
ccbsnr = ccbsnr->next;
|
||||
free(tmp);
|
||||
ast_free(tmp);
|
||||
}
|
||||
cc_mutex_unlock(&ccbsnr_lock);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ static void new_ccbsnr_id(char type, unsigned int plci,
|
|||
char buffer[CAPI_MAX_STRING];
|
||||
struct ccbsnr_s *ccbsnr;
|
||||
|
||||
ccbsnr = malloc(sizeof(struct ccbsnr_s));
|
||||
ccbsnr = ast_malloc(sizeof(struct ccbsnr_s));
|
||||
if (ccbsnr == NULL) {
|
||||
cc_log(LOG_ERROR, "Unable to allocate CCBS/CCNR struct.\n");
|
||||
return;
|
||||
|
@ -259,7 +259,7 @@ static void del_ccbsnr_ref(unsigned int plci, _cword ref)
|
|||
} else {
|
||||
tmp->next = ccbsnr->next;
|
||||
}
|
||||
free(ccbsnr);
|
||||
ast_free(ccbsnr);
|
||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 CC_MESSAGE_NAME
|
||||
": PLCI=%#x CCBS/CCNR removed ref=0x%04x\n", plci, ref);
|
||||
break;
|
||||
|
@ -319,7 +319,7 @@ static void del_ccbsnr_id(unsigned int plci, _cword id)
|
|||
} else {
|
||||
tmp->next = ccbsnr->next;
|
||||
}
|
||||
free(ccbsnr);
|
||||
ast_free(ccbsnr);
|
||||
cc_verbose(1, 1, VERBOSE_PREFIX_3 CC_MESSAGE_NAME ": PLCI=%#x CCBS/CCNR removed "
|
||||
"id=0x%04x state=%d\n", plci, id, oldstate);
|
||||
} else {
|
||||
|
@ -409,13 +409,13 @@ static void ccbsnr_remote_user_free(_cmsg *CMSG, char type, unsigned int PLCI, _
|
|||
c->dialed.number.str = ast_strdup (ccbsnr->exten);
|
||||
#else
|
||||
if (c->cid.cid_num) {
|
||||
free(c->cid.cid_num);
|
||||
ast_free(c->cid.cid_num);
|
||||
}
|
||||
c->cid.cid_num = strdup(handlename);
|
||||
c->cid.cid_num = ast_strdup(handlename);
|
||||
if (c->cid.cid_dnid) {
|
||||
free(c->cid.cid_dnid);
|
||||
ast_free(c->cid.cid_dnid);
|
||||
}
|
||||
c->cid.cid_dnid = strdup(ccbsnr->exten);
|
||||
c->cid.cid_dnid = ast_strdup(ccbsnr->exten);
|
||||
#endif
|
||||
|
||||
#ifndef CC_AST_HAS_EXT2_CHAN_ALLOC
|
||||
|
|
|
@ -132,7 +132,7 @@ void capi_remove_nullif(struct capi_pvt *i)
|
|||
cc_mutex_destroy(&i->lock);
|
||||
ast_cond_destroy(&i->event_trigger);
|
||||
controller_nullplcis[i->controller - 1]--;
|
||||
free(i);
|
||||
ast_free(i);
|
||||
break;
|
||||
}
|
||||
tmp = ii;
|
||||
|
@ -175,7 +175,7 @@ struct capi_pvt *capi_mknullif(struct ast_channel *c, unsigned long long control
|
|||
}
|
||||
}
|
||||
|
||||
tmp = malloc(sizeof(struct capi_pvt));
|
||||
tmp = ast_malloc(sizeof(struct capi_pvt));
|
||||
if (!tmp) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ struct capi_pvt *capi_mknullif(struct ast_channel *c, unsigned long long control
|
|||
capi_gains(&tmp->g, 1.0, 1.0);
|
||||
|
||||
if (!(capi_create_reader_writer_pipe(tmp))) {
|
||||
free(tmp);
|
||||
ast_free(tmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long con
|
|||
controller = data_plci_ifc->controller;
|
||||
}
|
||||
|
||||
data_ifc = malloc(sizeof(struct capi_pvt));
|
||||
data_ifc = ast_malloc(sizeof(struct capi_pvt));
|
||||
if (data_ifc == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ struct capi_pvt *capi_mkresourceif(struct ast_channel *c, unsigned long long con
|
|||
|
||||
if (data_plci_ifc == 0) {
|
||||
if (!(capi_create_reader_writer_pipe(data_ifc))) {
|
||||
free(data_ifc);
|
||||
ast_free(data_ifc);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -151,7 +151,7 @@ void capi_DivaStreamingOn(struct capi_pvt *i, byte streamCommand, _cword message
|
|||
if (diva_streaming_disabled)
|
||||
return;
|
||||
|
||||
pE = malloc (sizeof(*pE));
|
||||
pE = ast_malloc (sizeof(*pE));
|
||||
if (pE == 0)
|
||||
return;
|
||||
|
||||
|
@ -195,7 +195,7 @@ void capi_DivaStreamingOn(struct capi_pvt *i, byte streamCommand, _cword message
|
|||
diva_q_add_tail (&diva_streaming_new, &pE->link);
|
||||
} else {
|
||||
pE->diva_stream->release (pE->diva_stream);
|
||||
free (pE);
|
||||
ast_free (pE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ void divaStreamingWakeup (void)
|
|||
if (pE->i != 0) {
|
||||
pE->i->diva_stream_entry = 0;
|
||||
}
|
||||
free (pE);
|
||||
ast_free (pE);
|
||||
}
|
||||
cc_mutex_unlock(&stream_write_lock);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ void* diva_os_malloc (unsigned long flags, unsigned long size) {
|
|||
void* ret = 0;
|
||||
|
||||
if (size != 0) {
|
||||
ret = malloc (size);
|
||||
ret = ast_malloc (size);
|
||||
}
|
||||
|
||||
return (ret);
|
||||
|
@ -41,7 +41,7 @@ void* diva_os_malloc (unsigned long flags, unsigned long size) {
|
|||
|
||||
void diva_os_free (unsigned long flags, void* ptr) {
|
||||
if (ptr != 0) {
|
||||
free (ptr);
|
||||
ast_free (ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue