[Bug 36191] valgrind shows some potential leaks in crypt32/tests/cert.c

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Dec 16 21:47:04 CST 2018


https://bugs.winehq.org/show_bug.cgi?id=36191

--- Comment #5 from Austin English <austinenglish at gmail.com> ---
(In reply to Marc Bessières from comment #3)
> Created attachment 50140 [details]
> fix for definitely lost in testAddCert
> 
> Hi Austin,
> 
> In attachment I put a patch for the definite leak you reported:
> Also a definite leak:
> ==17318== 48 bytes in 1 blocks are definitely lost in loss record 159 of 334
> ==17318==    at 0x7BC4C6B7: notify_alloc (heap.c:255)
> ==17318==    by 0x7BC50EFB: RtlAllocateHeap (heap.c:1716)
> ==17318==    by 0x4EE398B: CryptMemAlloc (main.c:124)
> ==17318==    by 0x4EBE5A6: Context_CreateLinkContext (context.c:60)
> ==17318==    by 0x4EAAB00: Cert_clone (cert.c:127)
> ==17318==    by 0x4EBD199: CRYPT_CollectionCreateContextFromChild
> (collectionstore.c:85)
> ==17318==    by 0x4EBD485: CRYPT_CollectionAdvanceEnum
> (collectionstore.c:174)
> ==17318==    by 0x4EBD6EE: Collection_enumCert (collectionstore.c:247)
> ==17318==    by 0x4F05CB9: CertEnumCertificatesInStore (store.c:946)
> ==17318==    by 0x4EAE3F7: cert_compare_certs_in_store (cert.c:1528)
> ==17318==    by 0x4EAEF02: CertFindCertificateInStore (cert.c:1794)
> ==17318==    by 0x4EAAD3C: add_cert_to_store (cert.c:192)
> ==17318==    by 0x4EAB27F: CertAddCertificateContextToStore (cert.c:287)
> ==17318==    by 0x4CC9B54: testAddCert (cert.c:306)
> ==17318==    by 0x4CD8F2F: func_cert (cert.c:3976)
> ==17318==    by 0x4D33F67: run_test (test.h:584)
> ==17318==    by 0x4D34356: main (test.h:654)
> 
> The problem was that CertFindCertificateInStore was not called for a
> variable allocated with CertFindCertificateInStore.
> 
> If you have some time could you check if it works for you?
> And also could you check if the patch seems correct?
> 
> Cheers,
> Marc

Hi Marc,

Sorry I missed this (years!) ago. With wine-4.0-rc2 and
valgrind-3.14.0.GIT-1d42a625ab-20181106, I currently see two potential leaks:

==20768== 20 bytes in 1 blocks are possibly lost in loss record 111 of 601
==20768==    at 0x7BC483AD: notify_alloc (heap.c:260)
==20768==    by 0x7BC4B8D1: RtlAllocateHeap (heap.c:1726)
==20768==    by 0x4DF6FEA: CryptMemAlloc (main.c:133)
==20768==    by 0x4DD8979: CertAddStoreToCollection (collectionstore.c:518)
==20768==    by 0x4E11BF3: CRYPT_SysOpenStoreW (store.c:586)
==20768==    by 0x4E118A7: CertOpenStore (store.c:900)
==20768==    by 0x4C22CDC: testGetIssuerCert (cert.c:1739)
==20768==    by 0x4C2A940: func_cert (cert.c:4073)
==20768==    by 0x4C6E986: run_test (test.h:617)
==20768==    by 0x4C6F3C4: main (test.h:701)

==20768== 48 bytes in 1 blocks are possibly lost in loss record 245 of 601
==20768==    at 0x7BC483AD: notify_alloc (heap.c:260)
==20768==    by 0x7BC4B8D1: RtlAllocateHeap (heap.c:1726)
==20768==    by 0x4DF6FEA: CryptMemAlloc (main.c:133)
==20768==    by 0x4DD8BC8: Context_CreateDataContext (context.c:32)
==20768==    by 0x4DCB4D9: Cert_clone (cert.c:141)
==20768==    by 0x4E1085F: MemStore_addContext (store.c:151)
==20768==    by 0x4E10A41: MemStore_addCert (store.c:243)
==20768==    by 0x4DCD500: add_cert_to_store (cert.c:269)
==20768==    by 0x4DCD801: CertAddCertificateContextToStore (cert.c:293)
==20768==    by 0x4C22B9E: testGetIssuerCert (cert.c:1721)
==20768==    by 0x4C2A940: func_cert (cert.c:4073)
==20768==    by 0x4C6E986: run_test (test.h:617)
==20768==    by 0x4C6F3C4: main (test.h:701)
==20768== 

While your patch cleanly applies (with some offsets), it doesn't seem to make a
difference. From a quick glance, it doesn't look like it affects these code
paths (though parts close to it).

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.


More information about the wine-bugs mailing list