[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Apparent CML memory leak



Hello

I'm trying to track down two memory leaks that appear to be occurring in our
application within the CM_RetrieveKey function in the Certificate Management
Library version 2.0.1.

We are testing with Rational Purify on a Solaris SPARC system.

The code in our application does the following:

  ValidKey_struct *vkp;
  Bytes_struct *bsp;
  ulong cmlsid;
  short cme;
  unsigned char *cert_data;
  ...
  cme = CM_RequestEncCertPath(cmlsid, cert_data, CM_SEARCH_UNTIL_FOUND,
&bsp);
  cme = CM_RetrieveKey(cmlsid, bsp->data, CM_CERTPATH_TYPE, &vkp,
CM_SEARCH_UNTIL_FOUND);
  ...
  CM_FreeValidKey(cmlsid, &vkp);
  CM_FreeBytes(cmlsid, &bsp);

When this code is invoked, two memory leaks occur with the following call
stacks (which unfortunately don't give me line numbers):

MLK: 310 bytes leaked in 2 blocks
  * This memory was allocated from:
 malloc         [rtlib.o]
 CMU_CopyBytesContent [CM_RetrieveKey.cpp]
 short buildCrlListFmObject(EncCRL_LL**,EncObject_LL*) [libcmapi_d.so]
 CM_RequestCRLs [CM_ReqOps.cpp]
 short checkCRLSearchResults(unsigned
long,Cert_struct*,int,char*,EncCRL_LL*,Bytes_struct**,CRL_struct**)
[libcmapi_d.so]
 short getValidCRL(unsigned
long,CertTree_LL*,EncCRL_LL*,SearchBounds,bool,CRL_struct**,CertType)
[libcmapi_d.so]
 short findValidCRL(unsigned
long,CertTree_LL*,CertType,dist_pts_LL*,unsigned
short,SearchBounds,bool,CRL_struct**) [libcmapi_d.so]
 short checkRevokeStatus(unsigned long,CertTree_LL*,SearchBounds)
[libcmapi_d.so]
 short validateCert(unsigned long,SearchBounds,CertTree_LL*,StateVariables*)
[libcmapi_d.so]
 short CMI::ValidatePath(unsigned
long,SearchBounds,CertTree_LL*,CML::ValidatedKey*) [CM_RetrieveKey.cpp]
 short CML::CertPath::Validate(CML::ValidatedKey*)const [CM_CertPath.cpp]
 short CML::CertPath::BuildAndValidate(unsigned
long,SearchBounds,float,CML::ValidatedKey*) [CM_CertPath.cpp]
 CM_RetrievePath [CM_RetrieveKey.cpp]
 CM_RetrieveKey [CM_RetrieveKey.cpp]
 ...

MLK: 24 bytes leaked in 2 blocks
  * This memory was allocated from:
 malloc         [rtlib.o]
 calloc         [rtlib.o]
 short buildCrlListFmObject(EncCRL_LL**,EncObject_LL*) [libcmapi_d.so]
 CM_RequestCRLs [CM_ReqOps.cpp]
 short checkCRLSearchResults(unsigned
long,Cert_struct*,int,char*,EncCRL_LL*,Bytes_struct**,CRL_struct**)
[libcmapi_d.so]
 short getValidCRL(unsigned
long,CertTree_LL*,EncCRL_LL*,SearchBounds,bool,CRL_struct**,CertType)
[libcmapi_d.so]
 short findValidCRL(unsigned
long,CertTree_LL*,CertType,dist_pts_LL*,unsigned
short,SearchBounds,bool,CRL_struct**) [libcmapi_d.so]
 short checkRevokeStatus(unsigned long,CertTree_LL*,SearchBounds)
[libcmapi_d.so]
 short validateCert(unsigned long,SearchBounds,CertTree_LL*,StateVariables*)
[libcmapi_d.so]
 short CMI::ValidatePath(unsigned
long,SearchBounds,CertTree_LL*,CML::ValidatedKey*) [CM_RetrieveKey.cpp]
 short CML::CertPath::Validate(CML::ValidatedKey*)const [CM_CertPath.cpp]
 short CML::CertPath::BuildAndValidate(unsigned
long,SearchBounds,float,CML::ValidatedKey*) [CM_CertPath.cpp]
 CM_RetrievePath [CM_RetrieveKey.cpp]
 CM_RetrieveKey [CM_RetrieveKey.cpp]
 ...

Can anyone tell me where this problem lies, or provide a fix for it already?
Obviously it's building a linked list of CRLs, but on looking at the code it
wasn't immediately obvious where it needs to be freed.

John Stark
E-mail: jas@xxxxxxxxxxxx
Tel: +44 (0) 1223 566732
Fax: +44 (0) 1223 566727
Mobile: +44 (0) 7968 110628