[client,common] fix data race

This commit is contained in:
Armin Novak 2024-10-23 11:39:19 +02:00
parent 0cb84a0d8f
commit d3f8cd3073
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105

View File

@ -1975,6 +1975,7 @@ BOOL cliprdr_file_context_update_server_data(CliprdrFileContext* file_context, w
CliprdrFuseClipDataEntry* clip_data_entry = NULL; CliprdrFuseClipDataEntry* clip_data_entry = NULL;
FILEDESCRIPTORW* files = NULL; FILEDESCRIPTORW* files = NULL;
UINT32 n_files = 0; UINT32 n_files = 0;
BOOL rc = FALSE;
WINPR_ASSERT(file_context); WINPR_ASSERT(file_context);
WINPR_ASSERT(clip); WINPR_ASSERT(clip);
@ -1986,6 +1987,7 @@ BOOL cliprdr_file_context_update_server_data(CliprdrFileContext* file_context, w
} }
HashTable_Lock(file_context->inode_table); HashTable_Lock(file_context->inode_table);
HashTable_Lock(file_context->clip_data_table);
if (does_server_support_clipdata_locking(file_context)) if (does_server_support_clipdata_locking(file_context))
clip_data_entry = HashTable_GetItemValue( clip_data_entry = HashTable_GetItemValue(
file_context->clip_data_table, (void*)(uintptr_t)file_context->current_clip_data_id); file_context->clip_data_table, (void*)(uintptr_t)file_context->current_clip_data_id);
@ -2001,29 +2003,19 @@ BOOL cliprdr_file_context_update_server_data(CliprdrFileContext* file_context, w
clip_data_dir_new(file_context, does_server_support_clipdata_locking(file_context), clip_data_dir_new(file_context, does_server_support_clipdata_locking(file_context),
file_context->current_clip_data_id); file_context->current_clip_data_id);
if (!clip_data_entry->clip_data_dir) if (!clip_data_entry->clip_data_dir)
{ goto fail;
HashTable_Unlock(file_context->inode_table);
free(files);
return FALSE;
}
if (!update_exposed_path(file_context, clip, clip_data_entry)) if (!update_exposed_path(file_context, clip, clip_data_entry))
{ goto fail;
HashTable_Unlock(file_context->inode_table);
free(files);
return FALSE;
}
if (!set_selection_for_clip_data_entry(file_context, clip_data_entry, files, n_files)) if (!set_selection_for_clip_data_entry(file_context, clip_data_entry, files, n_files))
{ goto fail;
HashTable_Unlock(file_context->inode_table);
free(files);
return FALSE;
}
HashTable_Unlock(file_context->inode_table);
rc = TRUE;
fail:
HashTable_Unlock(file_context->clip_data_table);
HashTable_Unlock(file_context->inode_table);
free(files); free(files);
return TRUE; return rc;
#else #else
return FALSE; return FALSE;
#endif #endif