[vlc-commits] win32: fix vlc_threadvar_set() return (fixes #19124)

Rémi Denis-Courmont git at videolan.org
Mon Nov 20 17:39:54 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Nov 20 18:38:57 2017 +0200| [570962da1d77ab1bcf5dfa713476e50be107605d] | committer: Rémi Denis-Courmont

win32: fix vlc_threadvar_set() return (fixes #19124)

This was not noticed since none of the call sites check for error.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=570962da1d77ab1bcf5dfa713476e50be107605d
---

 src/win32/thread.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/win32/thread.c b/src/win32/thread.c
index 40c294dd52..f370a781f0 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -280,11 +280,12 @@ void vlc_threadvar_delete (vlc_threadvar_t *p_tls)
 int vlc_threadvar_set (vlc_threadvar_t key, void *value)
 {
     int saved = GetLastError ();
-    int val = TlsSetValue (key->id, value) ? ENOMEM : 0;
 
-    if (val == 0)
-        SetLastError(saved);
-    return val;
+    if (!TlsSetValue(key->id, value))
+        return ENOMEM;
+
+    SetLastError(saved);
+    return 0;
 }
 
 void *vlc_threadvar_get (vlc_threadvar_t key)



More information about the vlc-commits mailing list