[asterisk-commits] trunk r13423 - /trunk/rtp.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Mar 18 11:55:37 MST 2006
Author: russell
Date: Sat Mar 18 12:55:35 2006
New Revision: 13423
URL: http://svn.digium.com/view/asterisk?rev=13423&view=rev
Log:
convert malloc+memset to ast_calloc
Modified:
trunk/rtp.c
Modified: trunk/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/rtp.c?rev=13423&r1=13422&r2=13423&view=diff
==============================================================================
--- trunk/rtp.c (original)
+++ trunk/rtp.c Sat Mar 18 12:55:35 2006
@@ -982,10 +982,9 @@
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 @@
ast_log(LOG_WARNING, "Unable to allocate socket: %s\n", strerror(errno));
return NULL;
}
+
return rtcp;
}
@@ -1002,10 +1002,9 @@
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();
More information about the asterisk-commits
mailing list