cryptnet: Fix memory leaks querying an object.

This commit is contained in:
Juan Lang 2009-11-19 10:11:12 -08:00 committed by Alexandre Julliard
parent 320407a174
commit 35dbc201ae
1 changed files with 4 additions and 0 deletions

View File

@ -1246,20 +1246,24 @@ static BOOL WINAPI CRYPT_CreateAny(LPCSTR pszObjectOid,
if (!CertAddCertificateContextToStore(store, if (!CertAddCertificateContextToStore(store,
context, CERT_STORE_ADD_ALWAYS, NULL)) context, CERT_STORE_ADD_ALWAYS, NULL))
ret = FALSE; ret = FALSE;
CertFreeCertificateContext(context);
break; break;
case CERT_QUERY_CONTENT_CRL: case CERT_QUERY_CONTENT_CRL:
if (!CertAddCRLContextToStore(store, if (!CertAddCRLContextToStore(store,
context, CERT_STORE_ADD_ALWAYS, NULL)) context, CERT_STORE_ADD_ALWAYS, NULL))
ret = FALSE; ret = FALSE;
CertFreeCRLContext(context);
break; break;
case CERT_QUERY_CONTENT_CTL: case CERT_QUERY_CONTENT_CTL:
if (!CertAddCTLContextToStore(store, if (!CertAddCTLContextToStore(store,
context, CERT_STORE_ADD_ALWAYS, NULL)) context, CERT_STORE_ADD_ALWAYS, NULL))
ret = FALSE; ret = FALSE;
CertFreeCTLContext(context);
break; break;
default: default:
CertAddStoreToCollection(store, contextStore, 0, 0); CertAddStoreToCollection(store, contextStore, 0, 0);
} }
CertCloseStore(contextStore, 0);
} }
else else
ret = FALSE; ret = FALSE;