From eb5d461ed4688cafadc76bebf329a2fae454dc12 Mon Sep 17 00:00:00 2001 From: tilghman Date: Wed, 6 Jun 2007 21:20:11 +0000 Subject: 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 --- channels/chan_mgcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'channels/chan_mgcp.c') diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 2efc0af5b..20b7447de 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -697,15 +697,18 @@ static int retrans_pkt(void *data) static int mgcp_postrequest(struct mgcp_endpoint *p, struct mgcp_subchannel *sub, char *data, int len, unsigned int seqno) { - struct mgcp_message *msg = ast_malloc(sizeof(*msg) + len); + struct mgcp_message *msg; struct mgcp_message *cur; - struct mgcp_gateway *gw = ((p && p->parent) ? p->parent : NULL); + struct mgcp_gateway *gw; struct timeval tv; + msg = ast_malloc(sizeof(*msg) + len); if (!msg) { return -1; } + gw = ((p && p->parent) ? p->parent : NULL); if (!gw) { + ast_free(msg); return -1; } /* SC -- cgit v1.2.3