Skip to content

Commit 583c817

Browse files
Ori Shalevdormando
Ori Shalev
authored andcommitted
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.
1 parent 7ff49d4 commit 583c817

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

extstore.c

+2
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ void *extstore_init(char *fn, struct extstore_conf *cf,
305305
e->maint_thread = calloc(1, sizeof(store_maint_thread));
306306
e->maint_thread->e = e;
307307
// FIXME: error handling
308+
pthread_mutex_init(&e->maint_thread->mutex, NULL);
309+
pthread_cond_init(&e->maint_thread->cond, NULL);
308310
pthread_create(&thread, NULL, extstore_maint_thread, e->maint_thread);
309311

310312
return (void *)e;

0 commit comments

Comments
 (0)