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)
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)
133 { 133 {
134 if (s->str == tmpstr) 134 if (s->str == tmpstr)
135 { 135 {
136 size_t ret = s->length;
136 eina_lock_release(&_mutex); 137 eina_lock_release(&_mutex);
137 return s->length; 138 return ret;
138 } 139 }
139 } 140 }
140 eina_lock_release(&_mutex); 141 eina_lock_release(&_mutex);