]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[libesl] Coverity 1546296 Check of thread-shared field evades lock acquisition
authorAndrey Volk <andywolk@gmail.com>
Fri, 31 Jan 2025 15:58:34 +0000 (18:58 +0300)
committerAndrey Volk <andywolk@gmail.com>
Mon, 3 Feb 2025 23:18:47 +0000 (02:18 +0300)
libs/esl/src/esl.c

index d29926eb5c548431bfa918bdc3040f95d9cd3b3c..f39bda83b1513e54e64922a992fa6ed1149d16bf 100644 (file)
@@ -1531,11 +1531,15 @@ ESL_DECLARE(esl_status_t) esl_send_recv_timed(esl_handle_t *handle, const char *
        const char *hval;
        esl_status_t status;
        
-    if (!handle || !handle->connected || handle->sock == ESL_SOCK_INVALID) {
-        return ESL_FAIL;
-    }
+       if (!handle) {
+               return ESL_FAIL;
+       }
 
        esl_mutex_lock(handle->mutex);
+       if (!handle->connected || handle->sock == ESL_SOCK_INVALID) {
+               esl_mutex_unlock(handle->mutex);
+               return ESL_FAIL;
+       }       
 
        esl_event_safe_destroy(&handle->last_sr_event);