Просмотр исходного кода

defect 1068
bug in saHandleDestroy could cause extra put on handle when the check is invalid


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@909 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 20 лет назад
Родитель
Сommit
a81e56bd60
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      lib/util.c

+ 2 - 2
lib/util.c

@@ -610,13 +610,13 @@ saHandleDestroy (
 	pthread_mutex_lock (&handleDatabase->mutex);
 	pthread_mutex_lock (&handleDatabase->mutex);
 
 
 	if (check != handleDatabase->handles[handle].check) {
 	if (check != handleDatabase->handles[handle].check) {
+		pthread_mutex_unlock (&handleDatabase->mutex);
 		error = SA_AIS_ERR_BAD_HANDLE;
 		error = SA_AIS_ERR_BAD_HANDLE;
-		goto error_exit;
+		return (error);
 	}
 	}
 
 
 	handleDatabase->handles[handle].state = SA_HANDLE_STATE_PENDINGREMOVAL;
 	handleDatabase->handles[handle].state = SA_HANDLE_STATE_PENDINGREMOVAL;
 
 
-error_exit:
 	pthread_mutex_unlock (&handleDatabase->mutex);
 	pthread_mutex_unlock (&handleDatabase->mutex);
 
 
 	saHandleInstancePut (handleDatabase, inHandle);
 	saHandleInstancePut (handleDatabase, inHandle);