diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 7e5cc92..7154f43 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -4944,7 +4944,9 @@ static int unload_module(void) return -1; } - close(mgcpsock); + if (mgcpsock > -1) { + close(mgcpsock); + } ast_rtp_glue_unregister(&mgcp_rtp_glue); ast_cli_unregister_multiple(cli_mgcp, sizeof(cli_mgcp) / sizeof(struct ast_cli_entry)); ast_sched_context_destroy(sched);