From ce9ec91897d8ddf1b26e8bb67d3dee2d482730a3 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Sun, 3 Jun 2007 06:10:27 +0000 Subject: ast_calloc janitor (Inspired by issue 9860) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@66981 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_nbs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'channels/chan_nbs.c') diff --git a/channels/chan_nbs.c b/channels/chan_nbs.c index 2cb912e54..3fb606f5a 100644 --- a/channels/chan_nbs.c +++ b/channels/chan_nbs.c @@ -122,7 +122,7 @@ static void nbs_destroy(struct nbs_pvt *p) if (p->nbs) nbs_delstream(p->nbs); ast_module_user_remove(p->u); - free(p); + ast_free(p); } static struct nbs_pvt *nbs_alloc(void *data) @@ -138,9 +138,8 @@ static struct nbs_pvt *nbs_alloc(void *data) opts++; } else opts = ""; - p = malloc(sizeof(struct nbs_pvt)); + p = ast_calloc(1, sizeof(*p)); if (p) { - memset(p, 0, sizeof(struct nbs_pvt)); if (!ast_strlen_zero(opts)) { if (strchr(opts, 'm')) flags |= NBS_FLAG_MUTE; @@ -157,7 +156,7 @@ static struct nbs_pvt *nbs_alloc(void *data) p->nbs = nbs_newstream("asterisk", stream, flags); if (!p->nbs) { ast_log(LOG_WARNING, "Unable to allocate new NBS stream '%s' with flags %d\n", stream, flags); - free(p); + ast_free(p); p = NULL; } else { /* Set for 8000 hz mono, 640 samples */ -- cgit v1.2.3