From 1a33c1b2b895566299ec76643659adacc239a3dc Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Mon, 23 Apr 2012 16:43:22 -0700 Subject: [PATCH] darwin: Eliminate a pthread mutex leak Signed-off-by: Jeremy Huddleston Tested-by: Charles Davis --- src/glx/apple/apple_glx_drawable.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/glx/apple/apple_glx_drawable.c b/src/glx/apple/apple_glx_drawable.c index 55302243358..db283023a63 100644 --- a/src/glx/apple/apple_glx_drawable.c +++ b/src/glx/apple/apple_glx_drawable.c @@ -135,6 +135,7 @@ release_drawable(struct apple_glx_drawable *d) static bool destroy_drawable(struct apple_glx_drawable *d) { + int err; d->lock(d); @@ -172,6 +173,12 @@ destroy_drawable(struct apple_glx_drawable *d) apple_glx_diagnostic("%s: freeing %p\n", __func__, (void *) d); + err = pthread_mutex_destroy(&d->mutex); + if (err) { + fprintf(stderr, "pthread_mutex_destroy error: %s\n", strerror(err)); + abort(); + } + free(d); /* So that the locks are balanced and the caller correctly unlocks. */ -- 2.30.2