Hans Leidekker (@hans) commented about dlls/cryptxml/cryptxml.c:
+HRESULT WINAPI CryptXmlClose( HCRYPTXML handle ) +{
- struct object *obj = (struct object *)handle;
- struct xmldoc *doc;
- struct signature *sig;
- TRACE( "handle %p\n", handle );
- if (!obj) return E_INVALIDARG;
- if (obj->magic != DOC_MAGIC) return S_FALSE;
- doc = (struct xmldoc *)obj;
- sig = (struct signature *)doc->ctx.rgpSignature[0];
- free( sig );
doc->ctx.rgpSignature[0] points to a CRYPT_XML_SIGNATURE which is contained in struct signature. What about something like this? ``` HRESULT WINAPI CryptXmlClose( HCRYPTXML handle ) { struct object *obj = (struct object *)handle;
FIXME( "handle %p\n", handle );
if (!obj) return E_INVALIDARG;
switch (obj->magic) { case DOC_MAGIC: { struct xmldoc *doc = (struct xmldoc *)obj; const CRYPT_XML_SIGNATURE *sig = doc->ctx.rgpSignature[0]; struct signature *sig_obj = CONTAINING_RECORD( sig, struct signature, sig );
free( sig_obj ); break; } case SIG_MAGIC: return S_FALSE; default: FIXME( "unhandled object magic %lx\n", obj->magic ); return E_NOTIMPL; }
free( obj ); return S_OK; }
```