summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_file_win32.c
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-11-20 13:02:37 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-11-20 13:02:37 +0900
commit7e8fb93206ee95945bb757267832537c13ab4287 (patch)
tree8ff6ef8d854f28ac0dbcb1ebc86d7df076c03ccf /src/lib/eina/eina_file_win32.c
parent0146e3dacc87189eba100bf5489498290ec9f86b (diff)
eina: fix a possible race condition during eina_file_close.
The lock on the main hash was taken to late (after we took the decision to remove the targeted Eina_File from the cache), this means it was possible to get an Eina_File from the cache that was going to be removed. This patch attempt to fix that potential race condition. Hopefully should fix T461.
Diffstat (limited to '')
-rw-r--r--src/lib/eina/eina_file_win32.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/eina/eina_file_win32.c b/src/lib/eina/eina_file_win32.c
index cddf2da81a..8290501869 100644
--- a/src/lib/eina/eina_file_win32.c
+++ b/src/lib/eina/eina_file_win32.c
@@ -366,9 +366,6 @@ eina_file_real_close(Eina_File *file)
366{ 366{
367 Eina_File_Map *map; 367 Eina_File_Map *map;
368 368
369 eina_hash_free(file->rmap);
370 eina_hash_free(file->map);
371
372 EINA_LIST_FREE(file->dead_map, map) 369 EINA_LIST_FREE(file->dead_map, map)
373 { 370 {
374 UnmapViewOfFile(map->map); 371 UnmapViewOfFile(map->map);
@@ -380,8 +377,6 @@ eina_file_real_close(Eina_File *file)
380 377
381 if (file->fm) CloseHandle(file->fm); 378 if (file->fm) CloseHandle(file->fm);
382 if (file->handle) CloseHandle(file->handle); 379 if (file->handle) CloseHandle(file->handle);
383
384 free(file);
385} 380}
386 381
387static void 382static void
@@ -837,6 +832,8 @@ eina_file_open(const char *path, Eina_Bool shared)
837 n->shared = shared; 832 n->shared = shared;
838 eina_lock_new(&n->lock); 833 eina_lock_new(&n->lock);
839 eina_hash_direct_add(_eina_file_cache, n->filename, n); 834 eina_hash_direct_add(_eina_file_cache, n->filename, n);
835
836 EINA_MAGIC_SET(n, EINA_FILE_MAGIC);
840 } 837 }
841 else 838 else
842 { 839 {