http://bugs.winehq.org/show_bug.cgi?id=20684
Summary: Memory leak in CryptGenKey/CryptDestroyKey? Product: Wine Version: 1.1.32 Platform: PC OS/Version: Linux Status: NEW Keywords: download, source, testcase Severity: normal Priority: P2 Component: rsaenh AssignedTo: wine-bugs@winehq.org ReportedBy: dank@kegel.com
Created an attachment (id=24711) --> (http://bugs.winehq.org/attachment.cgi?id=24711) minimal test showing problem
Chromium's unit_tests.exe's SignatureCreatorTest.BasicTest seems to show a leak in CryptGenKey():
972 bytes in 1 blocks are definitely lost in loss record 836 of 921 at RtlAllocateHeap (heap.c:1423) by ??? by ??? by ??? by CryptGenKey (crypt.c:1434) by base::RSAPrivateKey::Create (rsa_private_key_win.cc:35) by SignatureCreatorTest_BasicTest_Test::TestBody (signature_creator_unittest.cc:15)
I've extracted a minimal test case into the attached patch. To repeat, apply the patch and then run the rsaenh test under valgrind. It complains
972 bytes in 1 blocks are definitely lost in loss record 463 of 518 at RtlAllocateHeap (heap.c:1423) by new_object (handle.c:362) by new_key (rsaenh.c:834) by RSAENH_CPGenKey (rsaenh.c:3064) by CryptGenKey (crypt.c:1434) by func_rsaenh (rsaenh.c:2546) by run_test (test.h:535) by main (test.h:585)
It seems the reference count of the generated key starts off one too high, or something?