From 73254051463a81b9e139b5bdd53c00e911dbbfae Mon Sep 17 00:00:00 2001 From: Ryan Doyle Date: Mon, 9 Nov 2015 20:12:18 +1100 Subject: [PATCH] libpcp: unlock context before returning If called in a non-archive context, the context ctxp->lock c_lock is never unlocked. --- src/libpcp/src/logutil.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libpcp/src/logutil.c b/src/libpcp/src/logutil.c index 89c593914..b006eddd4 100644 --- a/src/libpcp/src/logutil.c +++ b/src/libpcp/src/logutil.c @@ -2268,8 +2268,12 @@ pmGetArchiveLabel(pmLogLabel *lp) { __pmContext *ctxp; ctxp = __pmHandleToPtr(pmWhichContext()); - if (ctxp == NULL || ctxp->c_type != PM_CONTEXT_ARCHIVE) + if (ctxp == NULL) + return PM_ERR_NOCONTEXT; + if (ctxp->c_type != PM_CONTEXT_ARCHIVE) { + PM_UNLOCK(ctxp->c_lock); return PM_ERR_NOCONTEXT; + } else { __pmLogLabel *rlp; /*