Archived Forum Post

Index of archived forum posts


Digital Certificate sample seems to leak enormously

Feb 19 '13 at 04:48

About the sample located here:

Using VS10 in debug mode, I see that there are lots of leaks when exiting the application. I experimented with Dispose (in C++) with no success but, using delete, I eliminated the leaks. Do we need and is it safe to use delete on the returned objects?

Modified code:

cs = ccs.OpenLocalSystemStore();

if (!(cs == 0 )) {

    CkCert *cert = 0;
    int numCerts;
    numCerts = cs->get_NumCertificates();
    int i;
    //  Print the distinguished name of each certificate
    for (i = 0; i <= numCerts - 1; i++) {
        cert = cs->GetCertificate(i);
        m_cLsCert.InsertString(-1, cert->subjectCN());
        **delete cert;**
**delete cs;**
else {

Accepted Answer

All Chilkat objects returned by a Chilkat method must be deleted by the application.

I updated the online example.


That's interesting, however doesn't the digital certificate should be hidden or at least decoded in way that it cannot be altered? i mean its a very sensitive topic that should have this kind of modification.