summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-10-28 18:23:02 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-10-28 18:32:40 +0900
commit60a34c1cd0e7e5b51bb83a07ffa2cae869eb0179 (patch)
tree94b024baf17bcd1c75378cc2de82fd49d5bca3ce /src/lib/eina
parent7338164468370056e35c206a47ca3fe1b1b61f38 (diff)
eina: avoid possible race condition when unreffing an Eina_File.
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_file_common.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index ac7d020eb5..e5b1250e09 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -445,12 +445,15 @@ eina_file_dup(Eina_File *file)
445EAPI void 445EAPI void
446eina_file_close(Eina_File *file) 446eina_file_close(Eina_File *file)
447{ 447{
448 Eina_Bool leave = EINA_TRUE;
449
448 EINA_SAFETY_ON_NULL_RETURN(file); 450 EINA_SAFETY_ON_NULL_RETURN(file);
449 451
450 eina_lock_take(&file->lock); 452 eina_lock_take(&file->lock);
451 file->refcount--; 453 file->refcount--;
454 if (file->refcount == 0) leave = EINA_FALSE;
452 eina_lock_release(&file->lock); 455 eina_lock_release(&file->lock);
453 if (file->refcount != 0) return; 456 if (leave) return;
454 457
455 eina_lock_take(&_eina_file_lock_cache); 458 eina_lock_take(&_eina_file_lock_cache);
456 459