diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-04-17 20:25:06 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-04-17 20:25:06 +0000 |
commit | ff51d7fb60a829ef159389920e7c1b8c07012a5a (patch) | |
tree | 7656f6a845ce739efd65e9f226c5554d718fc44f /lib | |
parent | aa567de2a147ff9bd4c7b40f3901f5f3848f411d (diff) |
pthread_key_create(3) explicitely says that the value associated
with a new key is NULL. So set the allocated memory to zero.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libX11/src/UIThrStubs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libX11/src/UIThrStubs.c b/lib/libX11/src/UIThrStubs.c index 1786510ba..8f9858c62 100644 --- a/lib/libX11/src/UIThrStubs.c +++ b/lib/libX11/src/UIThrStubs.c @@ -188,6 +188,7 @@ static int _Xthr_key_create_stub_(unsigned int *key, void (*destructor)(void *)) { void **tmp; + unsigned int i; if ((_Xthr_last_key_ % XTHR_KEYS_CHUNK) == 0) { tmp = realloc(_Xthr_keys_, @@ -196,6 +197,8 @@ _Xthr_key_create_stub_(unsigned int *key, void (*destructor)(void *)) free(_Xthr_keys_); return ENOMEM; } + for (i =_Xthr_last_key_; i<XTHR_KEYS_CHUNK; i++) + tmp[i] = 0; _Xthr_keys_ = tmp; } *key = _Xthr_last_key_++; @@ -218,4 +221,3 @@ _Xthr_getspecific_stub_(unsigned int key) return NULL; return(_Xthr_keys_[key]); } - |