summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-02-09 13:47:00 +0000
committerTom Hacohen <tom@stosb.com>2015-02-09 13:55:13 +0000
commitfb8dfe98cd940acade1b6bfe3f15c202b9757380 (patch)
tree98b665651d74c8b9a31cb4a734addf745d0ab22b
parentf7a6880d5b0f25c8004d2bb3ba6385cc0d8869c5 (diff)
downloadefl-fb8dfe98cd940acade1b6bfe3f15c202b9757380.tar.gz
Eina tmpstr: fix race condition.
We take a lock, search the list, and the release the lock before we finish using the values of the list. While unlikely, the string could be deleted in the meanwhile.
-rw-r--r--src/lib/eina/eina_tmpstr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/eina/eina_tmpstr.c b/src/lib/eina/eina_tmpstr.c
index 7181b75c65..a49279b698 100644
--- a/src/lib/eina/eina_tmpstr.c
+++ b/src/lib/eina/eina_tmpstr.c
@@ -133,8 +133,9 @@ eina_tmpstr_len(Eina_Tmpstr *tmpstr)
{
if (s->str == tmpstr)
{
+ size_t ret = s->length;
eina_lock_release(&_mutex);
- return s->length;
+ return ret;
}
}
eina_lock_release(&_mutex);