Skip to content

Commit

Permalink
Bugfix: missing initialization code for extstore maint thread objects
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ori Shalev authored and dormando committed Mar 25, 2018
1 parent 7ff49d4 commit 583c817
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions extstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 583c817

Please sign in to comment.