In results of static analyze of aspnetcore sources with Svace static analyzer I was found error of cathegory HANDLE_LEAK with message
new X509Certificate2(certificatePath, password, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.EphemeralKeySet) is not disposed at the end of the function
This error was found in internal method ImportCertificate
|
certificate = new X509Certificate2(certificatePath, password, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.EphemeralKeySet); |
I see, that there working with created certificate takes specific paths that include platform point, and in variable certificate it can be stored new certificate object.
|
SaveCertificate(certificate); |
But at all, how about to add correct disposing of object?
Maybe call of SaveCertificate method should be like:
using var _ = SaveCertifiicate(certificate);
Found by Linux Verification Center (linuxtesting.org) with SVACE.
In results of static analyze of aspnetcore sources with Svace static analyzer I was found error of cathegory HANDLE_LEAK with message
new X509Certificate2(certificatePath, password, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.EphemeralKeySet) is not disposed at the end of the function
This error was found in internal method
ImportCertificateaspnetcore/src/Shared/CertificateGeneration/CertificateManager.cs
Line 420 in 6ae3ea3
I see, that there working with created certificate takes specific paths that include platform point, and in variable
certificateit can be stored new certificate object.aspnetcore/src/Shared/CertificateGeneration/CertificateManager.cs
Line 449 in 6ae3ea3
But at all, how about to add correct disposing of object?
Maybe call of
SaveCertificatemethod should be like:Found by Linux Verification Center (linuxtesting.org) with SVACE.