From 1ce96ce9f5404ddaaad305fd551d34f3bd01914a Mon Sep 17 00:00:00 2001 From: Seven Du Date: Thu, 21 Mar 2013 12:58:15 +0800 Subject: [PATCH] fix seg when mod unload with event_sink listeners present --- src/mod/event_handlers/mod_event_socket/mod_event_socket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 28c8a99568..d8538caba2 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -597,7 +597,9 @@ static void send_disconnect(listener_t *listener, const char *message) } else { switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", mlen); } - + + if (!listener->sock) return; + len = strlen(disco_buf); switch_socket_send(listener->sock, disco_buf, &len); if (len > 0) {