Module: wine Branch: master Commit: 610c863e7531569771fdb3dfcbdd4d3057063451 URL: http://source.winehq.org/git/wine.git/?a=commit;h=610c863e7531569771fdb3dfcb...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Oct 18 10:50:23 2013 +0200
crypt32: Always return TRUE from CertFreeCTLContext.
---
dlls/crypt32/context.c | 6 +----- dlls/crypt32/crypt32_private.h | 4 +--- dlls/crypt32/ctl.c | 6 ++---- dlls/crypt32/tests/ctl.c | 12 ++++++++++-- 4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index 4809eea..d836b6f 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -74,14 +74,11 @@ void Context_AddRef(context_t *context) TRACE("(%p) ref=%d\n", context, context->ref); }
-BOOL Context_Release(context_t *context) +void Context_Release(context_t *context) { - BOOL ret = TRUE; - if (context->ref <= 0) { ERR("%p's ref count is %d\n", context, context->ref); - return FALSE; } if (InterlockedDecrement(&context->ref) == 0) { @@ -97,7 +94,6 @@ BOOL Context_Release(context_t *context) } else TRACE("%p's ref count is %d\n", context, context->ref); - return ret; }
void Context_CopyProperties(const void *to, const void *from) diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index dbb9ee5..50eb9e6 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -403,10 +403,8 @@ void Context_AddRef(context_t*) DECLSPEC_HIDDEN;
/* Decrements context's ref count. If context is a link context, releases its * linked context as well. - * If a data context has its ref count reach 0, calls dataContextFree on it. - * Returns FALSE if the reference count is <= 0 when called. */ -BOOL Context_Release(context_t *context) DECLSPEC_HIDDEN; +void Context_Release(context_t *context) DECLSPEC_HIDDEN;
/** * Context property list functions diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c index 3717b7d..1f95fdf 100644 --- a/dlls/crypt32/ctl.c +++ b/dlls/crypt32/ctl.c @@ -500,13 +500,11 @@ PCCTL_CONTEXT WINAPI CertDuplicateCTLContext(PCCTL_CONTEXT pCtlContext)
BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext) { - BOOL ret = TRUE; - TRACE("(%p)\n", pCTLContext);
if (pCTLContext) - ret = Context_Release(&ctl_from_ptr(pCTLContext)->base); - return ret; + Context_Release(&ctl_from_ptr(pCTLContext)->base); + return TRUE; }
DWORD WINAPI CertEnumCTLContextProperties(PCCTL_CONTEXT pCTLContext, diff --git a/dlls/crypt32/tests/ctl.c b/dlls/crypt32/tests/ctl.c index f292a4c..55bbc6e 100644 --- a/dlls/crypt32/tests/ctl.c +++ b/dlls/crypt32/tests/ctl.c @@ -190,6 +190,7 @@ static void testCreateCTL(void) static void testDupCTL(void) { PCCTL_CONTEXT context, dupContext; + BOOL res;
context = CertDuplicateCTLContext(NULL); ok(context == NULL, "expected NULL\n"); @@ -198,8 +199,15 @@ static void testDupCTL(void) dupContext = CertDuplicateCTLContext(context); ok(dupContext != NULL, "expected a context\n"); ok(dupContext == context, "expected identical context addresses\n"); - CertFreeCTLContext(dupContext); - CertFreeCTLContext(context); + + res = CertFreeCTLContext(dupContext); + ok(res, "CertFreeCTLContext failed\n"); + + res = CertFreeCTLContext(context); + ok(res, "CertFreeCTLContext failed\n"); + + res = CertFreeCTLContext(NULL); + ok(res, "CertFreeCTLContext failed\n"); }
static void checkHash(const BYTE *data, DWORD dataLen, ALG_ID algID,