diff options
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r-- | channels/chan_mgcp.c | 7 |
1 files changed, 5 insertions, 2 deletions
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 |