From 09e386dedaf6ef551567a1646deea3ef8c40fb22 Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Thu, 24 Jun 2010 10:02:55 -0500
Subject: [PATCH] add error checking

---
 libs/esl/ivrd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libs/esl/ivrd.c b/libs/esl/ivrd.c
index ed045f31d0..842ef6be13 100644
--- a/libs/esl/ivrd.c
+++ b/libs/esl/ivrd.c
@@ -47,8 +47,10 @@ static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struc
 		return;
 	}
 	
-
-	esl_attach_handle(&handle, client_sock, addr);
+	if (esl_attach_handle(&handle, client_sock, addr) != ESL_SUCCESS || !handle.info_event) {
+		esl_log(ESL_LOG_ERROR, "Socket Error\n");
+		exit(0);
+	}
 
 	if (!(path = esl_event_get_header(handle.info_event, "variable_ivr_path"))) {
 		esl_disconnect(&handle);