Commit c72570ce authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

crypt32: Use Context_Release instead of WINE_CONTEXT_INTERFACE.

parent 76066d1c
...@@ -163,7 +163,7 @@ static void *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store, ...@@ -163,7 +163,7 @@ static void *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store,
child = Context_GetLinkedContext(pPrev); child = Context_GetLinkedContext(pPrev);
Context_AddRef(context_from_ptr(child)); Context_AddRef(context_from_ptr(child));
child = contextFuncs->enumContext(storeEntry->store, child); child = contextFuncs->enumContext(storeEntry->store, child);
contextInterface->free(pPrev); Context_Release(context_from_ptr(pPrev));
pPrev = NULL; pPrev = NULL;
} }
else else
......
...@@ -206,7 +206,7 @@ void *ContextList_Add(struct ContextList *list, void *toLink, void *toReplace) ...@@ -206,7 +206,7 @@ void *ContextList_Add(struct ContextList *list, void *toLink, void *toReplace)
entry->prev->next = entry; entry->prev->next = entry;
entry->next->prev = entry; entry->next->prev = entry;
existing->prev = existing->next = existing; existing->prev = existing->next = existing;
list->contextInterface->free(toReplace); Context_Release(context_from_ptr(toReplace));
} }
else else
list_add_head(&list->contexts, entry); list_add_head(&list->contexts, entry);
...@@ -226,7 +226,7 @@ void *ContextList_Enum(struct ContextList *list, void *pPrev) ...@@ -226,7 +226,7 @@ void *ContextList_Enum(struct ContextList *list, void *pPrev)
struct list *prevEntry = ContextList_ContextToEntry(list, pPrev); struct list *prevEntry = ContextList_ContextToEntry(list, pPrev);
listNext = list_next(&list->contexts, prevEntry); listNext = list_next(&list->contexts, prevEntry);
list->contextInterface->free(pPrev); Context_Release(context_from_ptr(pPrev));
} }
else else
listNext = list_next(&list->contexts, &list->contexts); listNext = list_next(&list->contexts, &list->contexts);
...@@ -270,7 +270,7 @@ static void ContextList_Empty(struct ContextList *list) ...@@ -270,7 +270,7 @@ static void ContextList_Empty(struct ContextList *list)
TRACE("removing %p\n", context); TRACE("removing %p\n", context);
list_remove(entry); list_remove(entry);
list->contextInterface->free(context); Context_Release(context_from_ptr(context));
} }
LeaveCriticalSection(&list->cs); LeaveCriticalSection(&list->cs);
} }
......
...@@ -226,7 +226,6 @@ typedef BOOL (WINAPI *SetContextPropertyFunc)(const void *context, ...@@ -226,7 +226,6 @@ typedef BOOL (WINAPI *SetContextPropertyFunc)(const void *context,
DWORD dwPropID, DWORD dwFlags, const void *pvData); DWORD dwPropID, DWORD dwFlags, const void *pvData);
typedef BOOL (WINAPI *SerializeElementFunc)(const void *context, DWORD dwFlags, typedef BOOL (WINAPI *SerializeElementFunc)(const void *context, DWORD dwFlags,
BYTE *pbElement, DWORD *pcbElement); BYTE *pbElement, DWORD *pcbElement);
typedef BOOL (WINAPI *FreeContextFunc)(const void *context);
typedef BOOL (WINAPI *DeleteContextFunc)(const void *contex); typedef BOOL (WINAPI *DeleteContextFunc)(const void *contex);
/* An abstract context (certificate, CRL, or CTL) interface */ /* An abstract context (certificate, CRL, or CTL) interface */
...@@ -240,7 +239,6 @@ typedef struct _WINE_CONTEXT_INTERFACE ...@@ -240,7 +239,6 @@ typedef struct _WINE_CONTEXT_INTERFACE
GetContextPropertyFunc getProp; GetContextPropertyFunc getProp;
SetContextPropertyFunc setProp; SetContextPropertyFunc setProp;
SerializeElementFunc serialize; SerializeElementFunc serialize;
FreeContextFunc free;
DeleteContextFunc deleteFromStore; DeleteContextFunc deleteFromStore;
} WINE_CONTEXT_INTERFACE; } WINE_CONTEXT_INTERFACE;
......
...@@ -279,7 +279,7 @@ static BOOL CRYPT_QuerySerializedContextObject(DWORD dwObjectType, ...@@ -279,7 +279,7 @@ static BOOL CRYPT_QuerySerializedContextObject(DWORD dwObjectType,
end: end:
if (contextInterface && context) if (contextInterface && context)
contextInterface->free(context); Context_Release(context_from_ptr(context));
if (blob == &fileBlob) if (blob == &fileBlob)
CryptMemFree(blob->pbData); CryptMemFree(blob->pbData);
TRACE("returning %d\n", ret); TRACE("returning %d\n", ret);
......
...@@ -143,7 +143,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, ...@@ -143,7 +143,7 @@ static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType,
else else
TRACE("hash doesn't match, ignoring\n"); TRACE("hash doesn't match, ignoring\n");
} }
contextInterface->free(context); Context_Release(context_from_ptr(context));
} }
} }
} }
...@@ -242,7 +242,7 @@ static BOOL CRYPT_SerializeContextsToReg(HKEY key, ...@@ -242,7 +242,7 @@ static BOOL CRYPT_SerializeContextsToReg(HKEY key,
ret = TRUE; ret = TRUE;
} while (ret && context != NULL); } while (ret && context != NULL);
if (context) if (context)
contextInterface->free(context); Context_Release(context_from_ptr(context));
return ret; return ret;
} }
......
...@@ -409,7 +409,7 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement, ...@@ -409,7 +409,7 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement,
} }
else else
{ {
contextInterface->free(context); Context_Release(context_from_ptr(context));
context = NULL; context = NULL;
} }
} }
...@@ -461,7 +461,7 @@ static BOOL CRYPT_ReadSerializedStore(void *handle, ...@@ -461,7 +461,7 @@ static BOOL CRYPT_ReadSerializedStore(void *handle,
propHdr.propID == CERT_CTL_PROP_ID)) propHdr.propID == CERT_CTL_PROP_ID))
{ {
/* We have a new context, so free the existing one */ /* We have a new context, so free the existing one */
contextInterface->free(context); Context_Release(context_from_ptr(context));
} }
if (propHdr.cb > bufSize) if (propHdr.cb > bufSize)
{ {
...@@ -522,7 +522,7 @@ static BOOL CRYPT_ReadSerializedStore(void *handle, ...@@ -522,7 +522,7 @@ static BOOL CRYPT_ReadSerializedStore(void *handle,
if (contextInterface && context) if (contextInterface && context)
{ {
/* Free the last context added */ /* Free the last context added */
contextInterface->free(context); Context_Release(context_from_ptr(context));
} }
CryptMemFree(buf); CryptMemFree(buf);
ret = TRUE; ret = TRUE;
...@@ -638,7 +638,7 @@ static BOOL CRYPT_SerializeContextsToStream(SerializedOutputFunc output, ...@@ -638,7 +638,7 @@ static BOOL CRYPT_SerializeContextsToStream(SerializedOutputFunc output,
ret = TRUE; ret = TRUE;
} while (ret && context != NULL); } while (ret && context != NULL);
if (context) if (context)
contextInterface->free(context); Context_Release(context_from_ptr(context));
return ret; return ret;
} }
...@@ -996,7 +996,7 @@ BOOL WINAPI CertAddSerializedElementToStore(HCERTSTORE hCertStore, ...@@ -996,7 +996,7 @@ BOOL WINAPI CertAddSerializedElementToStore(HCERTSTORE hCertStore,
*pdwContentType = type; *pdwContentType = type;
ret = contextInterface->addContextToStore(hCertStore, context, ret = contextInterface->addContextToStore(hCertStore, context,
dwAddDisposition, ppvContext); dwAddDisposition, ppvContext);
contextInterface->free(context); Context_Release(context_from_ptr(context));
} }
else else
ret = FALSE; ret = FALSE;
......
...@@ -50,7 +50,6 @@ static const WINE_CONTEXT_INTERFACE gCertInterface = { ...@@ -50,7 +50,6 @@ static const WINE_CONTEXT_INTERFACE gCertInterface = {
(GetContextPropertyFunc)CertGetCertificateContextProperty, (GetContextPropertyFunc)CertGetCertificateContextProperty,
(SetContextPropertyFunc)CertSetCertificateContextProperty, (SetContextPropertyFunc)CertSetCertificateContextProperty,
(SerializeElementFunc)CertSerializeCertificateStoreElement, (SerializeElementFunc)CertSerializeCertificateStoreElement,
(FreeContextFunc)CertFreeCertificateContext,
(DeleteContextFunc)CertDeleteCertificateFromStore, (DeleteContextFunc)CertDeleteCertificateFromStore,
}; };
const WINE_CONTEXT_INTERFACE *pCertInterface = &gCertInterface; const WINE_CONTEXT_INTERFACE *pCertInterface = &gCertInterface;
...@@ -64,7 +63,6 @@ static const WINE_CONTEXT_INTERFACE gCRLInterface = { ...@@ -64,7 +63,6 @@ static const WINE_CONTEXT_INTERFACE gCRLInterface = {
(GetContextPropertyFunc)CertGetCRLContextProperty, (GetContextPropertyFunc)CertGetCRLContextProperty,
(SetContextPropertyFunc)CertSetCRLContextProperty, (SetContextPropertyFunc)CertSetCRLContextProperty,
(SerializeElementFunc)CertSerializeCRLStoreElement, (SerializeElementFunc)CertSerializeCRLStoreElement,
(FreeContextFunc)CertFreeCRLContext,
(DeleteContextFunc)CertDeleteCRLFromStore, (DeleteContextFunc)CertDeleteCRLFromStore,
}; };
const WINE_CONTEXT_INTERFACE *pCRLInterface = &gCRLInterface; const WINE_CONTEXT_INTERFACE *pCRLInterface = &gCRLInterface;
...@@ -78,7 +76,6 @@ static const WINE_CONTEXT_INTERFACE gCTLInterface = { ...@@ -78,7 +76,6 @@ static const WINE_CONTEXT_INTERFACE gCTLInterface = {
(GetContextPropertyFunc)CertGetCTLContextProperty, (GetContextPropertyFunc)CertGetCTLContextProperty,
(SetContextPropertyFunc)CertSetCTLContextProperty, (SetContextPropertyFunc)CertSetCTLContextProperty,
(SerializeElementFunc)CertSerializeCTLStoreElement, (SerializeElementFunc)CertSerializeCTLStoreElement,
(FreeContextFunc)CertFreeCTLContext,
(DeleteContextFunc)CertDeleteCTLFromStore, (DeleteContextFunc)CertDeleteCTLFromStore,
}; };
const WINE_CONTEXT_INTERFACE *pCTLInterface = &gCTLInterface; const WINE_CONTEXT_INTERFACE *pCTLInterface = &gCTLInterface;
......
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