summaryrefslogtreecommitdiff
path: root/extstore.c
diff options
context:
space:
mode:
authorOri Shalev <orish@fb.com>2018-03-24 16:11:38 -0700
committerdormando <dormando@rydia.net>2018-03-24 23:28:35 -0700
commit583c8177ada2f6fcfa556140b94b019d31588e4a (patch)
treedc787a720a6a1b6e403485933416b9c851f5bcc9 /extstore.c
parent7ff49d49de14856c0ec3f6c828ff2089fcc8425c (diff)
downloadmemcached-583c8177ada2f6fcfa556140b94b019d31588e4a.tar.gz
Bugfix: missing initialization code for extstore maint thread objects
The extstore maintenance thread takes permanent ownership of its mutex. Grabbing an uninitialized mutex can result in undefined behavior. In this case the memory is zeroed so probably no harm.
Diffstat (limited to 'extstore.c')
-rw-r--r--extstore.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/extstore.c b/extstore.c
index df7ba0e..23f0f14 100644
--- a/extstore.c
+++ b/extstore.c
@@ -305,6 +305,8 @@ void *extstore_init(char *fn, struct extstore_conf *cf,
e->maint_thread = calloc(1, sizeof(store_maint_thread));
e->maint_thread->e = e;
// FIXME: error handling
+ pthread_mutex_init(&e->maint_thread->mutex, NULL);
+ pthread_cond_init(&e->maint_thread->cond, NULL);
pthread_create(&thread, NULL, extstore_maint_thread, e->maint_thread);
return (void *)e;