Commit 610c863e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

crypt32: Always return TRUE from CertFreeCTLContext.

parent 35131414
...@@ -74,14 +74,11 @@ void Context_AddRef(context_t *context) ...@@ -74,14 +74,11 @@ void Context_AddRef(context_t *context)
TRACE("(%p) ref=%d\n", context, context->ref); 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) if (context->ref <= 0)
{ {
ERR("%p's ref count is %d\n", context, context->ref); ERR("%p's ref count is %d\n", context, context->ref);
return FALSE;
} }
if (InterlockedDecrement(&context->ref) == 0) if (InterlockedDecrement(&context->ref) == 0)
{ {
...@@ -97,7 +94,6 @@ BOOL Context_Release(context_t *context) ...@@ -97,7 +94,6 @@ BOOL Context_Release(context_t *context)
} }
else else
TRACE("%p's ref count is %d\n", context, context->ref); TRACE("%p's ref count is %d\n", context, context->ref);
return ret;
} }
void Context_CopyProperties(const void *to, const void *from) void Context_CopyProperties(const void *to, const void *from)
......
...@@ -403,10 +403,8 @@ void Context_AddRef(context_t*) DECLSPEC_HIDDEN; ...@@ -403,10 +403,8 @@ void Context_AddRef(context_t*) DECLSPEC_HIDDEN;
/* Decrements context's ref count. If context is a link context, releases its /* Decrements context's ref count. If context is a link context, releases its
* linked context as well. * 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 * Context property list functions
......
...@@ -500,13 +500,11 @@ PCCTL_CONTEXT WINAPI CertDuplicateCTLContext(PCCTL_CONTEXT pCtlContext) ...@@ -500,13 +500,11 @@ PCCTL_CONTEXT WINAPI CertDuplicateCTLContext(PCCTL_CONTEXT pCtlContext)
BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext) BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext)
{ {
BOOL ret = TRUE;
TRACE("(%p)\n", pCTLContext); TRACE("(%p)\n", pCTLContext);
if (pCTLContext) if (pCTLContext)
ret = Context_Release(&ctl_from_ptr(pCTLContext)->base); Context_Release(&ctl_from_ptr(pCTLContext)->base);
return ret; return TRUE;
} }
DWORD WINAPI CertEnumCTLContextProperties(PCCTL_CONTEXT pCTLContext, DWORD WINAPI CertEnumCTLContextProperties(PCCTL_CONTEXT pCTLContext,
......
...@@ -190,6 +190,7 @@ static void testCreateCTL(void) ...@@ -190,6 +190,7 @@ static void testCreateCTL(void)
static void testDupCTL(void) static void testDupCTL(void)
{ {
PCCTL_CONTEXT context, dupContext; PCCTL_CONTEXT context, dupContext;
BOOL res;
context = CertDuplicateCTLContext(NULL); context = CertDuplicateCTLContext(NULL);
ok(context == NULL, "expected NULL\n"); ok(context == NULL, "expected NULL\n");
...@@ -198,8 +199,15 @@ static void testDupCTL(void) ...@@ -198,8 +199,15 @@ static void testDupCTL(void)
dupContext = CertDuplicateCTLContext(context); dupContext = CertDuplicateCTLContext(context);
ok(dupContext != NULL, "expected a context\n"); ok(dupContext != NULL, "expected a context\n");
ok(dupContext == context, "expected identical context addresses\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, static void checkHash(const BYTE *data, DWORD dataLen, ALG_ID algID,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment