From d853042b5f6ae67bddd87045e9f80438e4bd92f4 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 9 May 2018 06:39:38 +0300 Subject: Added missing write_unlock() in case of errors --- sql/sql_sequence.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sql/sql_sequence.cc') diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index cb208a7b2e0..21a8781087f 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -459,7 +459,10 @@ int SEQUENCE::read_initial_values(TABLE *table) mdl_requests.push_front(&mdl_request); if (thd->mdl_context.acquire_locks(&mdl_requests, thd->variables.lock_wait_timeout)) + { + write_unlock(table); DBUG_RETURN(HA_ERR_LOCK_WAIT_TIMEOUT); + } } save_lock_type= table->reginfo.lock_type; table->reginfo.lock_type= TL_READ; @@ -468,6 +471,7 @@ int SEQUENCE::read_initial_values(TABLE *table) { if (mdl_lock_used) thd->mdl_context.release_lock(mdl_request.ticket); + write_unlock(table); DBUG_RETURN(HA_ERR_LOCK_WAIT_TIMEOUT); } DBUG_ASSERT(table->reginfo.lock_type == TL_READ); -- cgit v1.2.1