Properly close PKCS12 files when enumerating stores
authorKevin Jones <kevin@vcsjones.com>
Sun, 23 Jul 2023 03:42:40 +0000 (23:42 -0400)
committerGitHub <noreply@github.com>
Sun, 23 Jul 2023 03:42:40 +0000 (20:42 -0700)
src/native/libs/System.Security.Cryptography.Native/pal_x509.c

index 5dbd1bd..40f7c60 100644 (file)
@@ -353,7 +353,7 @@ int32_t CryptoNative_X509StoreCtxRebuildChain(X509_STORE_CTX* ctx)
 int32_t CryptoNative_X509StoreCtxSetVerifyCallback(X509_STORE_CTX* ctx, X509StoreVerifyCallback callback, void* appData)
 {
     ERR_clear_error();
-    
+
     X509_STORE_CTX_set_verify_cb(ctx, callback);
 
     return X509_STORE_CTX_set_app_data(ctx, appData);
@@ -527,6 +527,10 @@ static X509* ReadNextPublicCert(DIR* dir, X509Stack* tmpStack, char* pathTmp, si
                         return cert;
                     }
                 }
+                else
+                {
+                    fclose(fp);
+                }
             }
         }
     }