crypt32(9/13): Add an error if the ref count is invalid when releasing a context

View: New views
1 Messages — Rating Filter:   Alert me  

crypt32(9/13): Add an error if the ref count is invalid when releasing a context

by Juan Lang-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I added an assert in my patch attached to bug 20503, but it's possible
to trigger this condition through a buggy program too.  An assert
doesn't seem appropriate in that case.
--Juan

[0009-Add-an-error-if-the-ref-count-is-invalid-when-releas.patch]

From 1c924c31c52028b747fd51464fdd129c6564360a Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang@...>
Date: Tue, 3 Nov 2009 16:46:50 -0800
Subject: [PATCH] Add an error if the ref count is invalid when releasing a context

---
 dlls/crypt32/context.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c
index b8ad220..e0c1932 100644
--- a/dlls/crypt32/context.c
+++ b/dlls/crypt32/context.c
@@ -173,7 +173,10 @@ BOOL Context_Release(void *context, size_t contextSize,
     BOOL ret = TRUE;
 
     if (base->ref <= 0)
+    {
+        ERR("%p's ref count is %d\n", context, base->ref);
         return FALSE;
+    }
     if (base->type == ContextTypeLink)
     {
         /* The linked context is of the same type as this, so release
--
1.6.0.6