aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_vpb.cc
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-06 21:20:11 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-06 21:20:11 +0000
commiteb5d461ed4688cafadc76bebf329a2fae454dc12 (patch)
tree5503cb153c9de46c07e3a0a521cc996926ed375b /channels/chan_vpb.cc
parent125558c76fd4870a9133e4974cce6410c89a3593 (diff)
Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67864 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_vpb.cc')
-rw-r--r--channels/chan_vpb.cc25
1 files changed, 12 insertions, 13 deletions
diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc
index 3cacf0313..748f58f7b 100644
--- a/channels/chan_vpb.cc
+++ b/channels/chan_vpb.cc
@@ -679,10 +679,10 @@ static void get_callerid(struct vpb_pvt *p)
if ((rc=vpb_cid_decode2(cli_struct, buf, CID_MSECS*8)) == VPB_OK ) {
/*
if (owner->cid.cid_num)
- free(owner->cid.cid_num);
+ ast_free(owner->cid.cid_num);
owner->cid.cid_num=NULL;
if (owner->cid.cid_name)
- free(owner->cid.cid_name);
+ ast_free(owner->cid.cid_name);
owner->cid.cid_name=NULL;
*/
@@ -791,11 +791,11 @@ static void get_callerid_ast(struct vpb_pvt *p)
ast_log(LOG_ERROR, "%s: Failed to create Caller ID struct\n", p->dev );
}
if (owner->cid.cid_num) {
- free(owner->cid.cid_num);
+ ast_free(owner->cid.cid_num);
owner->cid.cid_num = NULL;
}
if (owner->cid.cid_name) {
- free(owner->cid.cid_name);
+ ast_free(owner->cid.cid_name);
owner->cid.cid_name = NULL;
}
if (number)
@@ -1239,10 +1239,10 @@ static inline int monitor_handle_notowned(struct vpb_pvt *p, VPB_EVENT *e)
if (owner){
/*
if (owner->cid.cid_num)
- free(owner->cid.cid_num);
+ ast_free(owner->cid.cid_num);
owner->cid.cid_num=NULL;
if (owner->cid.cid_name)
- free(owner->cid.cid_name);
+ ast_free(owner->cid.cid_name);
owner->cid.cid_name=NULL;
owner->cid.cid_num = strdup(p->callerid);
*/
@@ -1499,11 +1499,10 @@ static void mkbrd(vpb_model_t model, int echo_cancel)
if(!bridges) {
if(model==vpb_model_v4pci)
max_bridges = MAX_BRIDGES_V4PCI;
- bridges = (vpb_bridge_t *)malloc(max_bridges * sizeof(vpb_bridge_t) );
+ bridges = ast_calloc(1, max_bridges * sizeof(vpb_bridge_t));
if(!bridges)
ast_log(LOG_ERROR, "Failed to initialize bridges\n");
else {
- memset(bridges,0,max_bridges * sizeof(vpb_bridge_t));
for(int i = 0; i < max_bridges; i++ ) {
ast_mutex_init(&bridges[i].lock);
ast_cond_init(&bridges[i].cond, NULL);
@@ -1544,7 +1543,7 @@ static struct vpb_pvt *mkif(int board, int channel, int mode, int gains, float t
struct vpb_pvt *tmp;
char buf[64];
- tmp = (struct vpb_pvt *)calloc(1, sizeof *tmp);
+ tmp = ast_calloc(1, sizeof(*tmp));
if (!tmp)
return NULL;
@@ -1554,7 +1553,7 @@ static struct vpb_pvt *mkif(int board, int channel, int mode, int gains, float t
if (tmp->handle < 0) {
ast_log(LOG_WARNING, "Unable to create channel vpb/%d-%d: %s\n",
board, channel, strerror(errno));
- free(tmp);
+ ast_free(tmp);
return NULL;
}
@@ -2741,7 +2740,7 @@ static struct ast_channel *vpb_request(const char *type, int format, void *data,
ast_verbose(VERBOSE_PREFIX_2 " %s requested, got: [%s]\n",
name, tmp ? tmp->name : "None");
- free(name);
+ ast_free(name);
restart_monitor();
return tmp;
@@ -2814,7 +2813,7 @@ int unload_module()
iflist = iflist->next;
- free(p);
+ ast_free(p);
}
iflist = NULL;
} ast_mutex_unlock(&iflock);
@@ -2827,7 +2826,7 @@ int unload_module()
ast_mutex_destroy(&bridges[i].lock);
ast_cond_destroy(&bridges[i].cond);
}
- free(bridges);
+ ast_free(bridges);
return 0;
}