From d57e37a5235d8ddafa67d4b4e4dca5f3c2126591 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Tue, 30 Apr 2013 14:33:09 +0200 Subject: Fix uninitialized mutex usage in synctask_destroy synctask_new() initialize task->mutex is task->synccbk is NULL. synctask_done() calls synctask_destroy() if task->synccbk is not NULL. synctask_destroy() always destroys the mutex. Fix that by checking for task->synccbk in synctask_destroy() BUG: 764655 Change-Id: I50bb53bc6e2738dc0aa830adc4c1ea37b24ee2a0 Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.org/4913 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/syncop.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 4e3c93a4..f58bfcec 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -179,9 +179,10 @@ synctask_destroy (struct synctask *task) if (task->opframe) STACK_DESTROY (task->opframe->root); - pthread_mutex_destroy (&task->mutex); - - pthread_cond_destroy (&task->cond); + if (task->synccbk == NULL) { + pthread_mutex_destroy (&task->mutex); + pthread_cond_destroy (&task->cond); + } FREE (task); } -- cgit