summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2013-04-30 14:33:09 +0200
committerAnand Avati <avati@redhat.com>2013-04-30 20:12:11 -0700
commitd57e37a5235d8ddafa67d4b4e4dca5f3c2126591 (patch)
treeb598bcc0080390fb3b3e08307dbda776128ab60c /libglusterfs
parent7967e3e5cfd330190c2bcc45d3a111a1d563a7a0 (diff)
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 <manu@netbsd.org> Reviewed-on: http://review.gluster.org/4913 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/syncop.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 4e3c93a45f8..f58bfcecab4 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);
}