diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-06-03 06:10:27 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-06-03 06:10:27 +0000 |
commit | ce9ec91897d8ddf1b26e8bb67d3dee2d482730a3 (patch) | |
tree | 47467b33841bb4ba9ac822e234ee2cac2218aef4 /channels/chan_features.c | |
parent | b1490716f6adf54f7282322bbee7cb04de632f23 (diff) |
ast_calloc janitor (Inspired by issue 9860)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@66981 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_features.c')
-rw-r--r-- | channels/chan_features.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/channels/chan_features.c b/channels/chan_features.c index 813e701b5..03a2f4ce6 100644 --- a/channels/chan_features.c +++ b/channels/chan_features.c @@ -387,7 +387,7 @@ static int features_hangup(struct ast_channel *ast) ast_hangup(p->subchan); ast_mutex_unlock(&p->lock); ast_mutex_destroy(&p->lock); - free(p); + ast_free(p); return 0; } ast_mutex_unlock(&p->lock); @@ -428,9 +428,8 @@ static struct feature_pvt *features_alloc(char *data, int format) ast_log(LOG_NOTICE, "Unable to allocate subchannel '%s/%s'\n", tech, dest); return NULL; } - tmp = malloc(sizeof(struct feature_pvt)); + tmp = ast_calloc(1, sizeof(*tmp)); if (tmp) { - memset(tmp, 0, sizeof(struct feature_pvt)); for (x=0;x<3;x++) init_sub(tmp->subs + x); ast_mutex_init(&tmp->lock); @@ -461,7 +460,7 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in /* figure out what you want the name to be */ for (x=1;x<4;x++) { if (b2) - free(b2); + ast_free(b2); asprintf(&b2, "%s/%s-%d", p->tech, p->dest, x); for (y=0;y<3;y++) { if (y == index) @@ -475,7 +474,7 @@ static struct ast_channel *features_new(struct feature_pvt *p, int state, int in tmp = ast_channel_alloc(0, state, 0,0, "", "", "", 0, "Feature/%s", b2); /* free up the name, it was copied into the channel name */ if (b2) - free(b2); + ast_free(b2); if (!tmp) { ast_log(LOG_WARNING, "Unable to allocate channel structure\n"); return NULL; @@ -566,7 +565,7 @@ static int unload_module(void) if (p->owner) ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD); AST_LIST_REMOVE_CURRENT(&features, list); - free(p); + ast_free(p); } AST_LIST_TRAVERSE_SAFE_END AST_LIST_UNLOCK(&features); |