]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Avoiding segfault
authorMathieu Rene <mrene@avgs.ca>
Fri, 27 Feb 2009 15:38:33 +0000 (15:38 +0000)
committerMathieu Rene <mrene@avgs.ca>
Fri, 27 Feb 2009 15:38:33 +0000 (15:38 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12323 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/esl/src/esl.c

index 5b2d197ba90c8582fa1d0b1a848db26c618e78bb..86dde3137619cc6058c3cb40d9e99408a5f0cd66 100644 (file)
@@ -381,8 +381,8 @@ ESL_DECLARE(char *)esl_url_decode(char *s)
 static void sock_setup(esl_handle_t *handle)
 {
 #ifdef WIN32
-       BOOL bOptVal = TRUE;\r
-       int bOptLen = sizeof(BOOL);\r
+       BOOL bOptVal = TRUE;
+       int bOptLen = sizeof(BOOL);
        setsockopt(handle->sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&bOptVal, bOptLen);
 #else
        int x = 1;
@@ -712,7 +712,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms
        int max, activity;
        esl_status_t status = ESL_SUCCESS;
 
-       if (!handle->connected) {
+       if (!handle->connected || !handle || handle->sock == -1) {
                return ESL_FAIL;
        }