aboutsummaryrefslogtreecommitdiffstats
path: root/rtp.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-18 18:55:35 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-03-18 18:55:35 +0000
commit0f642e9987c66cd1cbfa11a3b95c07d84bd27e7d (patch)
tree1d9d2c07c60903742000791ea4afce3fe43fd39b /rtp.c
parent4803d1a813c098710f2f58afd56a51dafee9c819 (diff)
convert malloc+memset to ast_calloc
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@13423 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rw-r--r--rtp.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/rtp.c b/rtp.c
index 8437e4324..1437c55bd 100644
--- a/rtp.c
+++ b/rtp.c
@@ -982,10 +982,9 @@ static int rtp_socket(void)
static struct ast_rtcp *ast_rtcp_new(void)
{
struct ast_rtcp *rtcp;
- rtcp = malloc(sizeof(struct ast_rtcp));
- if (!rtcp)
+
+ if (!(rtcp = ast_calloc(1, sizeof(*rtcp))))
return NULL;
- memset(rtcp, 0, sizeof(struct ast_rtcp));
rtcp->s = rtp_socket();
rtcp->us.sin_family = AF_INET;
if (rtcp->s < 0) {
@@ -993,6 +992,7 @@ static struct ast_rtcp *ast_rtcp_new(void)
ast_log(LOG_WARNING, "Unable to allocate socket: %s\n", strerror(errno));
return NULL;
}
+
return rtcp;
}
@@ -1002,10 +1002,9 @@ struct ast_rtp *ast_rtp_new_with_bindaddr(struct sched_context *sched, struct io
int x;
int first;
int startplace;
- rtp = malloc(sizeof(struct ast_rtp));
- if (!rtp)
+
+ if (!(rtp = ast_calloc(1, sizeof(*rtp))))
return NULL;
- memset(rtp, 0, sizeof(struct ast_rtp));
rtp->them.sin_family = AF_INET;
rtp->us.sin_family = AF_INET;
rtp->s = rtp_socket();