From: William King Date: Fri, 21 Feb 2014 22:11:54 +0000 (-0800) Subject: ESL-82 --resolve X-Git-Tag: v1.5.8~25^2~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fb660933d8971ec2245d899490bc2b802270230;p=thirdparty%2Ffreeswitch.git ESL-82 --resolve Previously any esl_connect_timeout() failures would not return to the calling application the reason for the failure. This commit now allows for calling applications to know why the connection attempt fails, but it is now the calling applications responsiblity to call esl_disconnect() on the esl handle after the failure. Failing to call disconnect after a failed connection attempt would result in memory being leaked. --- diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 587db6c75e..bf9d3499dd 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -967,7 +967,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char * int err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { snprintf(handle->err, sizeof(handle->err), "WSAStartup Error"); - return ESL_FAIL; + goto fail; } #endif @@ -1009,7 +1009,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char * if (handle->sock == ESL_SOCK_INVALID) { snprintf(handle->err, sizeof(handle->err), "Socket Error"); - return ESL_FAIL; + goto fail; } if (timeout) { @@ -1110,7 +1110,6 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char * fail: handle->connected = 0; - esl_disconnect(handle); return ESL_FAIL; }