Skip to content

Commit 29d6c43

Browse files
committed
[libesl] Coverity 1589045 Check of thread-shared field evades lock acquisition
1 parent 304d535 commit 29d6c43

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

libs/esl/src/esl.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,20 +1167,20 @@ ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle)
11671167
esl_event_safe_destroy(&handle->last_ievent);
11681168
esl_event_safe_destroy(&handle->info_event);
11691169

1170-
if (mutex) {
1171-
esl_mutex_unlock(mutex);
1172-
esl_mutex_lock(mutex);
1173-
esl_mutex_unlock(mutex);
1174-
esl_mutex_destroy(&mutex);
1175-
}
1176-
11771170
if (handle->packet_buf) {
11781171
esl_buffer_destroy(&handle->packet_buf);
11791172
}
11801173

11811174
memset(handle, 0, sizeof(*handle));
11821175
handle->destroyed = 1;
11831176

1177+
if (mutex) {
1178+
esl_mutex_unlock(mutex);
1179+
esl_mutex_lock(mutex);
1180+
esl_mutex_unlock(mutex);
1181+
esl_mutex_destroy(&mutex);
1182+
}
1183+
11841184
return status;
11851185
}
11861186

0 commit comments

Comments
 (0)