瀏覽代碼

libobs: Add missing mutex unlocks to some filter functions

Detected by Coverity Scan (CID 12831, 12830)
Richard Stanway 10 年之前
父節點
當前提交
4b9d0256c8
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      libobs/obs-source.c

+ 4 - 1
libobs/obs-source.c

@@ -1532,6 +1532,7 @@ void obs_source_filter_add(obs_source_t *source, obs_source_t *filter)
 	if (da_find(source->filters, &filter, 0) != DARRAY_INVALID) {
 		blog(LOG_WARNING, "Tried to add a filter that was already "
 		                  "present on the source");
+		pthread_mutex_unlock(&source->filter_mutex);
 		return;
 	}
 
@@ -1565,8 +1566,10 @@ static bool obs_source_filter_remove_refless(obs_source_t *source,
 	pthread_mutex_lock(&source->filter_mutex);
 
 	idx = da_find(source->filters, &filter, 0);
-	if (idx == DARRAY_INVALID)
+	if (idx == DARRAY_INVALID) {
+		pthread_mutex_unlock(&source->filter_mutex);
 		return false;
+	}
 
 	if (idx > 0) {
 		obs_source_t *prev = source->filters.array[idx-1];