diff options
Diffstat (limited to 'res')
-rw-r--r-- | res/ael/ael.flex | 1 | ||||
-rw-r--r-- | res/ael/ael.tab.c | 1 | ||||
-rw-r--r-- | res/ael/ael.y | 1 | ||||
-rw-r--r-- | res/ael/ael_lex.c | 1 | ||||
-rw-r--r-- | res/ael/pval.c | 1 | ||||
-rw-r--r-- | res/res_config_ldap.c | 16 | ||||
-rw-r--r-- | res/res_phoneprov.c | 4 | ||||
-rw-r--r-- | res/res_pktccops.c | 70 | ||||
-rw-r--r-- | res/res_rtp_asterisk.c | 2 | ||||
-rw-r--r-- | res/res_smdi.c | 6 |
10 files changed, 54 insertions, 49 deletions
diff --git a/res/ael/ael.flex b/res/ael/ael.flex index 0b6ec32f1..5a7fd8304 100644 --- a/res/ael/ael.flex +++ b/res/ael/ael.flex @@ -68,6 +68,7 @@ %option bison-locations %{ +#define WRAP_LIBC_MALLOC #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") diff --git a/res/ael/ael.tab.c b/res/ael/ael.tab.c index c838d797c..8fe93f39e 100644 --- a/res/ael/ael.tab.c +++ b/res/ael/ael.tab.c @@ -99,6 +99,7 @@ * */ +#define WRAP_LIBC_MALLOC #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") diff --git a/res/ael/ael.y b/res/ael/ael.y index 27e04c583..c1a6f0f2b 100644 --- a/res/ael/ael.y +++ b/res/ael/ael.y @@ -22,6 +22,7 @@ * */ +#define WRAP_LIBC_MALLOC #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") diff --git a/res/ael/ael_lex.c b/res/ael/ael_lex.c index 6aec03bee..053906305 100644 --- a/res/ael/ael_lex.c +++ b/res/ael/ael_lex.c @@ -1,3 +1,4 @@ +#define WRAP_LIBC_MALLOC #include "asterisk.h" #line 2 "ael_lex.c" diff --git a/res/ael/pval.c b/res/ael/pval.c index d72ef0d59..736382732 100644 --- a/res/ael/pval.c +++ b/res/ael/pval.c @@ -27,6 +27,7 @@ <support_level>extended</support_level> ***/ +#define WRAP_LIBC_MALLOC #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c index fd21aab80..06ffbfb7c 100644 --- a/res/res_config_ldap.c +++ b/res/res_config_ldap.c @@ -124,7 +124,7 @@ static struct ldap_table_config *table_config_new(const char *table_name) if (table_name) { if (!(p->table_name = ast_strdup(table_name))) { - free(p); + ast_free(p); return NULL; } } @@ -238,7 +238,7 @@ static void table_configs_free(void) if (c->attributes) { ast_variables_destroy(c->attributes); } - free(c); + ast_free(c); } base_table_config = NULL; @@ -516,14 +516,14 @@ static struct ast_variable **realtime_ldap_result_to_vars(struct ldap_table_conf is_delimited = 0; pos = 0; } - free(delim_value); + ast_free(delim_value); delim_value = NULL; ast_debug(4, "LINE(%d) DELIM pos: %d i: %d\n", __LINE__, pos, i); } else { /* not delimited */ if (delim_value) { - free(delim_value); + ast_free(delim_value); delim_value = NULL; } ast_debug(2, "LINE(%d) attribute_name: %s value: %s\n", __LINE__, attribute_name, valptr); @@ -1007,7 +1007,7 @@ static struct ast_variable *realtime_ldap(const char *basedn, } p++; } - free(vars); + ast_free(vars); } return var; } @@ -1066,7 +1066,7 @@ static struct ast_config *realtime_multi_ldap(const char *basedn, p++; } } - free(vars); + ast_free(vars); } return cfg; @@ -1365,8 +1365,8 @@ static int update_ldap(const char *basedn, const char *table_name, const char *a ast_log(LOG_WARNING, "Query: %s\n", ast_str_buffer(filter)); ast_mutex_unlock(&ldap_lock); - free(filter); - free(clean_basedn); + ast_free(filter); + ast_free(clean_basedn); ldap_msgfree(ldap_result_msg); ldap_mods_free(ldap_mods, 0); return -1; diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c index e9a6b8fb4..b8b52787d 100644 --- a/res/res_phoneprov.c +++ b/res/res_phoneprov.c @@ -272,7 +272,7 @@ static int profile_cmp_fn(void *obj, void *arg, int flags) static void delete_file(struct phoneprov_file *file) { ast_string_field_free_memory(file); - free(file); + ast_free(file); } static void profile_destructor(void *obj) @@ -340,7 +340,7 @@ static int load_file(const char *filename, char **ret) return -2; if (len != fread(*ret, sizeof(char), len, f)) { - free(*ret); + ast_free(*ret); *ret = NULL; return -3; } diff --git a/res/res_pktccops.c b/res/res_pktccops.c index 87727d8ce..e1d9d40e8 100644 --- a/res/res_pktccops.c +++ b/res/res_pktccops.c @@ -340,7 +340,7 @@ static int cops_getmsg (int sfd, struct copsmsg *recmsg) recmsg->length = ntohl(*((uint32_t *) (buf + 4))); /* Eg KA msg*/ if (recmsg->clienttype != 0x8008 ) { - if (!(recmsg->msg = malloc(recmsg->length - COPS_HEADER_SIZE))) { + if (!(recmsg->msg = ast_malloc(recmsg->length - COPS_HEADER_SIZE))) { return -1; } lent = recv(sfd, recmsg->msg, recmsg->length - COPS_HEADER_SIZE, MSG_DONTWAIT); @@ -353,12 +353,12 @@ static int cops_getmsg (int sfd, struct copsmsg *recmsg) while (len < recmsg->length) { if (len == COPS_HEADER_SIZE) { /* 1st round */ - if (!(recmsg->object = malloc(sizeof(struct pktcobj)))) { + if (!(recmsg->object = ast_malloc(sizeof(struct pktcobj)))) { return -1; } pobject = recmsg->object; } else { - if (!(pobject->next = malloc(sizeof(struct pktcobj)))) { + if (!(pobject->next = ast_malloc(sizeof(struct pktcobj)))) { return -1; } pobject = pobject->next; @@ -373,7 +373,7 @@ static int cops_getmsg (int sfd, struct copsmsg *recmsg) pobject->length = ntohs(*ubuf); pobject->cnum = *(buf + 2); pobject->ctype = *(buf + 3); - if (!(pobject->contents = malloc(pobject->length - COPS_OBJECT_HEADER_SIZE))) { + if (!(pobject->contents = ast_malloc(pobject->length - COPS_OBJECT_HEADER_SIZE))) { return -1; } lent = recv(sfd, pobject->contents, pobject->length - COPS_OBJECT_HEADER_SIZE, MSG_DONTWAIT); @@ -402,7 +402,7 @@ static int cops_sendmsg (int sfd, struct copsmsg * sendmsg) ast_log(LOG_WARNING, "COPS: invalid msg size!!!\n"); return -1; } - if (!(buf = malloc((size_t) sendmsg->length))) { + if (!(buf = ast_malloc((size_t) sendmsg->length))) { return -1; } *buf = sendmsg->verflag ; @@ -419,7 +419,7 @@ static int cops_sendmsg (int sfd, struct copsmsg * sendmsg) ast_debug(3, "COPS: Sending Object : cnum: %i ctype %i len: %i\n", pobject->cnum, pobject->ctype, pobject->length); if (sendmsg->length < bufpos + pobject->length) { ast_log(LOG_WARNING, "COPS: Invalid msg size len: %u objectlen: %i\n", sendmsg->length, pobject->length); - free(buf); + ast_free(buf); return -1; } *(uint16_t *) (buf + bufpos) = htons(pobject->length); @@ -427,7 +427,7 @@ static int cops_sendmsg (int sfd, struct copsmsg * sendmsg) *(buf + bufpos + 3) = pobject->ctype; if (sendmsg->length < pobject->length + bufpos) { ast_log(LOG_WARNING, "COPS: Error sum of object len more the msg len %u < %i\n", sendmsg->length, pobject->length + bufpos); - free(buf); + ast_free(buf); return -1; } memcpy((buf + bufpos + 4), pobject->contents, pobject->length - 4); @@ -444,18 +444,18 @@ static int cops_sendmsg (int sfd, struct copsmsg * sendmsg) #endif if (send(sfd, buf, sendmsg->length, SENDFLAGS) == -1) { ast_log(LOG_WARNING, "COPS: Send failed errno=%i\n", errno); - free(buf); + ast_free(buf); return -2; } #undef SENDFLAGS - free(buf); + ast_free(buf); return 0; } static void cops_freemsg(struct copsmsg *p) { struct pktcobj *pnext; - free(p->msg); + ast_free(p->msg); p->msg = NULL; while (p->object != NULL) { pnext = p->object->next; @@ -555,8 +555,8 @@ static struct cops_gate *cops_gate_cmd(int cmd, struct cops_cmts *cmts, gate->in_transaction = time(NULL); - if (!(gateset = malloc(sizeof(struct copsmsg)))) { - free(gateset); + if (!(gateset = ast_malloc(sizeof(struct copsmsg)))) { + ast_free(gateset); return NULL; } gateset->msg = NULL; @@ -565,67 +565,67 @@ static struct cops_gate *cops_gate_cmd(int cmd, struct cops_cmts *cmts, gateset->clienttype = 0x8008; /* =PacketCable */ /* Handle object */ - gateset->object = malloc(sizeof(struct pktcobj)); + gateset->object = ast_malloc(sizeof(struct pktcobj)); if (!gateset->object) { cops_freemsg(gateset); - free(gateset); + ast_free(gateset); return NULL; } gateset->object->length = COPS_OBJECT_HEADER_SIZE + 4; gateset->object->cnum = 1; /* Handle */ gateset->object->ctype = 1; /* client */ - if (!(gateset->object->contents = malloc(sizeof(uint32_t)))) { + if (!(gateset->object->contents = ast_malloc(sizeof(uint32_t)))) { cops_freemsg(gateset); - free(gateset); + ast_free(gateset); return NULL; } *((uint32_t *) gateset->object->contents) = htonl(cmts->handle); /* Context Object */ - if (!(gateset->object->next = malloc(sizeof(struct pktcobj)))) { + if (!(gateset->object->next = ast_malloc(sizeof(struct pktcobj)))) { cops_freemsg(gateset); - free(gateset); + ast_free(gateset); return NULL; } gateset->object->next->length = COPS_OBJECT_HEADER_SIZE + 4; gateset->object->next->cnum = 2; /* Context */ gateset->object->next->ctype = 1; /* Context */ - if (!(gateset->object->next->contents = malloc(sizeof(uint32_t)))) { + if (!(gateset->object->next->contents = ast_malloc(sizeof(uint32_t)))) { cops_freemsg(gateset); - free(gateset); + ast_free(gateset); return NULL; } *((uint32_t *) gateset->object->next->contents) = htonl(0x00080000); /* R-Type = 8 configuration request, M-Type = 0 */ /* Decision Object: Flags */ - if (!(gateset->object->next->next = malloc(sizeof(struct pktcobj)))) { + if (!(gateset->object->next->next = ast_malloc(sizeof(struct pktcobj)))) { cops_freemsg(gateset); - free(gateset); + ast_free(gateset); return NULL; } gateset->object->next->next->length = COPS_OBJECT_HEADER_SIZE + 4; gateset->object->next->next->cnum = 6; /* Decision */ gateset->object->next->next->ctype = 1; /* Flags */ - if (!(gateset->object->next->next->contents = malloc(sizeof(uint32_t)))) { + if (!(gateset->object->next->next->contents = ast_malloc(sizeof(uint32_t)))) { cops_freemsg(gateset); - free(gateset); + ast_free(gateset); return NULL; } *((uint32_t *) gateset->object->next->next->contents) = htonl(0x00010001); /* Install, Trigger Error */ /* Decision Object: Data */ - if (!(gateset->object->next->next->next = malloc(sizeof(struct pktcobj)))) { + if (!(gateset->object->next->next->next = ast_malloc(sizeof(struct pktcobj)))) { cops_freemsg(gateset); - free(gateset); + ast_free(gateset); return NULL; } gateset->object->next->next->next->length = COPS_OBJECT_HEADER_SIZE + ((cmd != GATE_INFO && cmd != GATE_DEL) ? GATE_SET_OBJ_SIZE : GATE_INFO_OBJ_SIZE) + ((cmd == GATE_SET_HAVE_GATEID) ? GATEID_OBJ_SIZE : 0); gateset->object->next->next->next->cnum = 6; /* Decision */ gateset->object->next->next->next->ctype = 4; /* Decision Data */ - gateset->object->next->next->next->contents = malloc(((cmd != GATE_INFO && cmd != GATE_DEL) ? GATE_SET_OBJ_SIZE : GATE_INFO_OBJ_SIZE) + ((cmd == GATE_SET_HAVE_GATEID) ? GATEID_OBJ_SIZE : 0)); + gateset->object->next->next->next->contents = ast_malloc(((cmd != GATE_INFO && cmd != GATE_DEL) ? GATE_SET_OBJ_SIZE : GATE_INFO_OBJ_SIZE) + ((cmd == GATE_SET_HAVE_GATEID) ? GATEID_OBJ_SIZE : 0)); if (!gateset->object->next->next->next->contents) { cops_freemsg(gateset); - free(gateset); + ast_free(gateset); return NULL; } gateset->object->next->next->next->next = NULL; @@ -644,7 +644,7 @@ static struct cops_gate *cops_gate_cmd(int cmd, struct cops_cmts *cmts, } cops_sendmsg(cmts->sfd, gateset); cops_freemsg(gateset); - free(gateset); + ast_free(gateset); return gate; } @@ -929,11 +929,11 @@ static void *do_pktccops(void *data) sendmsg->opcode = 7; /* Client Accept */ sendmsg->clienttype = 0x8008; /* =PacketCable */ sendmsg->length = COPS_HEADER_SIZE + COPS_OBJECT_HEADER_SIZE + 4; - sendmsg->object = malloc(sizeof(struct pktcobj)); + sendmsg->object = ast_malloc(sizeof(struct pktcobj)); sendmsg->object->length = 4 + COPS_OBJECT_HEADER_SIZE; sendmsg->object->cnum = 10; /* keppalive timer*/ sendmsg->object->ctype = 1; - sendmsg->object->contents = malloc(sizeof(uint32_t)); + sendmsg->object->contents = ast_malloc(sizeof(uint32_t)); *((uint32_t *) sendmsg->object->contents) = htonl(cmts->keepalive & 0x0000ffff); sendmsg->object->next = NULL; cops_sendmsg(cmts->sfd, sendmsg); @@ -980,7 +980,7 @@ static void *do_pktccops(void *data) close(cmts->sfd); } AST_LIST_REMOVE_CURRENT(list); - free(cmts); + ast_free(cmts); } } AST_LIST_TRAVERSE_SAFE_END; @@ -1442,13 +1442,13 @@ static void pktccops_unregister_cmtses(void) if (cmts->sfd > 0) { close(cmts->sfd); } - free(cmts); + ast_free(cmts); } AST_LIST_UNLOCK(&cmts_list); AST_LIST_LOCK(&gate_list); while ((gate = AST_LIST_REMOVE_HEAD(&gate_list, list))) { - free(gate); + ast_free(gate); } AST_LIST_UNLOCK(&gate_list); } @@ -1458,7 +1458,7 @@ static void pktccops_unregister_ippools(void) struct cops_ippool *ippool; AST_LIST_LOCK(&ippool_list); while ((ippool = AST_LIST_REMOVE_HEAD(&ippool_list, list))) { - free(ippool); + ast_free(ippool); } AST_LIST_UNLOCK(&ippool_list); } diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 5cb67e6f0..bf65ec00c 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -4914,7 +4914,7 @@ static void ast_rtp_stop(struct ast_rtp_instance *instance) if (rtp->red) { AST_SCHED_DEL(rtp->sched, rtp->red->schedid); - free(rtp->red); + ast_free(rtp->red); rtp->red = NULL; } diff --git a/res/res_smdi.c b/res/res_smdi.c index c7e0ab29a..02f2e4a79 100644 --- a/res/res_smdi.c +++ b/res/res_smdi.c @@ -246,7 +246,7 @@ static void smdi_interface_destroy(void *obj) ast_mutex_destroy(&iface->mwi_q_lock); ast_cond_destroy(&iface->mwi_q_cond); - free(iface); + ast_free(iface); ast_module_unref(ast_module_info->self); } @@ -770,7 +770,7 @@ static void destroy_mailbox_mapping(struct mailbox_mapping *mm) { ast_string_field_free_memory(mm); ao2_ref(mm->iface, -1); - free(mm); + ast_free(mm); } static void destroy_all_mailbox_mappings(void) @@ -1151,7 +1151,7 @@ static void smdi_msg_datastore_destroy(void *data) ao2_cleanup(smd->iface); ao2_cleanup(smd->md_msg); - free(smd); + ast_free(smd); } static const struct ast_datastore_info smdi_msg_datastore_info = { |