Memory leak in ADODB Connection15::Open method



We have a client server application using ASP, ATL COM and SqlServer. We have
found 36 bytes of memory leak in Connection15::Open method when we ran
Rational Purify and we have no idea why it is happening. Here is the example
code.

"dbbase.cpp"
------------------
void CDBBase::CreateDBHandle (CDBBase& pObj, bool bReadonly)
{
CreateDBHandle (bReadonly);
pObj.CopyDBHandle (this);
}

void CDBBase::CopyDBHandle (CDBBase* pObj)
{
m_pConn = pObj->m_pConn;
m_bDBHandleCreated = false;
}

void CDBBase::CreateDBHandle (bool bReadonly)
{
if (m_pConn == NULL)
{
m_pConn.CreateInstance (AdoGuids.m_Connection);

if (g_CommandTimeout == -1)
InitQueryTimeout();

m_pConn->CommandTimeout = g_CommandTimeout;

m_pConn->Open (
m_bstrLogonString,
bstrEmpty,
bstrEmpty,
ADODB::adConnectUnspecified );

m_bDBHandleCreated = true;
}
}


"msado15.tli"
-------------
inline HRESULT Connection15::Open ( _bstr_t ConnectionString, _bstr_t
UserID, _bstr_t Password, long Options ) {
HRESULT _hr = raw_Open(ConnectionString, UserID, Password, Options);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}

Purify is showing a memory leak of 36 bytes in Connection15::Open method
above.

[W] MLK: Memory leak of 36 bytes from 1 block allocated in
ADODB::Connection15::Open(_bstr_t,_bstr_t,_bstr_t,long)
[ImplementationLibrary.dll]
Distribution of leaked blocks
Allocation location
LocalAlloc [C:\WINNT\system32\KERNEL32.DLL]
ADODB::Connection15::Open(_bstr_t,_bstr_t,_bstr_t,long)
[o:\applogic\interm\debug\supportlibrary\msado15.tli:1229]
}

inline HRESULT Connection15::Open ( _bstr_t
ConnectionString, _bstr_t UserID, _bstr_t Password, long Options ) {
=> HRESULT _hr = raw_Open(ConnectionString, UserID,
Password, Options);
if (FAILED(_hr)) _com_issue_errorex(_hr, this,
__uuidof(this));
return _hr;
}

CDBBase::CreateDBHandle(bool)
[d:\broker\common\develop\supportlibrary\dbbase.cpp:121]
m_bstrLogonString,
bstrEmpty,
bstrEmpty,
=> ADODB::adConnectUnspecified );

//m_pConn->PutCursorLocation(ADODB::adUseClient);
// NOTE: Above line is necessary for fetching
resultsets and output parameters.

CDBBase::CreateDBHandle(CDBBase&,bool)
[d:\broker\common\develop\supportlibrary\dbbase.cpp:150]
EXTLOG ("CreateDBHandle(): creating and copying DB
handle");
#endif

=> CreateDBHandle (bReadonly);
pObj.CopyDBHandle (this);
}

We are using MDAC version 2.81, Visual C++ .NET, Microsoft Development
Environment 2003 and Microsoft .NET Framework 1.1

Any help regarding the memory leak fix would be greatly appreciated.

Thanks,
-amar
.



Relevant Pages

  • Re: Damn you, FEDEX! or Nikon D40 lost in Springfield, MO blackhole.
    ... the 2 mp Mavica he had been using with a Nikon D40. ... After shopping around, he got me to order one for him. ... The shipper had it insured, but from what I have read it could take weeks to sort this crap out. ... You may get your insurance from FedEx and a couple weeks later they find it and deliver it. ...
    (alt.photography)
  • Re: Memory leak
    ... > void f ... There is no pointer pointing to it anymore, ... means you have no way of freeing it again: you created a memory leak. ... So the correct sequence in your example would be: ...
    (comp.lang.cpp)
  • Re: C++ is slow
    ... >> void main ... > If you use anything else besides 'int' return type ... > You have a memory leak. ... >> PROG II ...
    (comp.lang.cpp)
  • Re: ComboBox DeleteItem() not being called for all items?
    ... On 12 Dec, 01:58, Giovanni Dicanio ... No more "Memory leak detected".. ... I also had to remove void ... CLpCombo::DeleteItem(LPDELETEITEMSTRUCT lpDeleteItemStruct) since it ...
    (microsoft.public.vc.mfc)
  • Re: obj function hello()
    ... gert wrote: ... Can you collaborated on the memory leak part please? ... void leak(size_t howmuch) { ...
    (comp.lang.c)