windows thread support frees thread local storage after TlsSetValue
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 21 Sep 2006 02:43:12 +0000 (02:43 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 21 Sep 2006 02:43:12 +0000 (02:43 +0000)
  threads.c: The return value of TlsSetValue is non-zero on
                   success.  As a result of misinterpreting the
                   return value, the memory set in TLS is then freed.
   A subsequent call to TlsGetValue returns the
   invalid pointer.

ticket: new
tags: pullup

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18600 dc483132-0cff-0310-8789-dd5450dbe970

src/util/support/threads.c

index ebc1dafaeafce218aae335e31b34e49ed5670b50..7693cbb53396be935f0f8155ec366735386ad5ec 100644 (file)
@@ -275,9 +275,9 @@ int k5_setspecific (k5_key_t keynum, void *value)
        /* add to global linked list */
        /*      t->next = 0; */
        err = TlsSetValue(tls_idx, t);
-       if (err) {
+       if (!err) {
            free(t);
-           return err;
+           return GetLastError();
        }
     }