File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store,
166166
167167 cert_blob .pbData = (BYTE * )CURL_UNCONST (begin_cert_ptr );
168168 cert_blob .cbData = cert_size ;
169+ /* Caution: CryptQueryObject() is deprecated */
169170 if (!CryptQueryObject (CERT_QUERY_OBJECT_BLOB ,
170171 & cert_blob ,
171172 CERT_QUERY_CONTENT_FLAG_CERT ,
@@ -204,7 +205,6 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store,
204205 cert_context ,
205206 CERT_STORE_ADD_ALWAYS ,
206207 NULL );
207- CertFreeCertificateContext (cert_context );
208208 if (!add_cert_result ) {
209209 char buffer [WINAPI_ERROR_LEN ];
210210 failf (data ,
@@ -220,6 +220,21 @@ static CURLcode add_certs_data_to_store(HCERTSTORE trust_store,
220220 num_certs ++ ;
221221 }
222222 }
223+
224+ switch (actual_content_type ) {
225+ case CERT_QUERY_CONTENT_CERT :
226+ case CERT_QUERY_CONTENT_SERIALIZED_CERT :
227+ CertFreeCertificateContext (cert_context );
228+ break ;
229+ case CERT_QUERY_CONTENT_CRL :
230+ case CERT_QUERY_CONTENT_SERIALIZED_CRL :
231+ CertFreeCRLContext ((PCCRL_CONTEXT )cert_context );
232+ break ;
233+ case CERT_QUERY_CONTENT_CTL :
234+ case CERT_QUERY_CONTENT_SERIALIZED_CTL :
235+ CertFreeCTLContext ((PCCTL_CONTEXT )cert_context );
236+ break ;
237+ }
223238 }
224239 }
225240 }
You can’t perform that action at this time.
0 commit comments