summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2013-05-01 06:23:57 +0200
committerAnand Avati <avati@redhat.com>2013-05-04 00:32:22 -0700
commitdfa76943df9c36c3c7f5b31cf153b3c4bbc2ac2e (patch)
treef0eb5daf993ac0fe8aa68690e9533783872d20ad
parentbae32a5affd514e5a78ba3af6cc644cd5cd6814a (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() This is a backport of I50bb53bc6e2738dc0aa830adc4c1ea37b24ee2a0 BUG: 764655 Change-Id: I3d6292f05a986ae3ceee35161791348ce3771c12 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/4920 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-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 e2a049271..87f398417 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);
}