hi,guys,
i has been puzzled with the following problem about memory leak in VC++6.anyone knows what results in the problem? thaz in advance.
.h file

class VolRec
{
public:
VolRec(){
m_wNumCharaList = 0;
#ifdef _UNICODE
m_pCharaList = NULL;
#else
m_pCharaList = NULL;

#endif
...
}
virtual ~ VolRec(){
if(m_pCharaList != NULL){
delete [] m_pCharaList;
m_pCharaList = NULL;
}

}
VolRec operator = (const VolRec& vc){
...
if(m_wNumCharaList!=0){
#ifdef _UNICODE
int num = m_wNumCharaList/2;
m_pCharaList = new WCHAR[num+1];
for(int i = 0; i <= num;i++ ){
m_pCharaList[i] = vc.m_pCharaList[i];
}
#else
int num = m_wNumCharaList;
m_pCharaList = new char [num+1];
for(int i = 0; i<= num; i++){
m_pCharaList[i] = vc.m_pCharaList[i];
}
#endif
}

...

return *this;
}
VolRec(const VolRec& vc){
...
if(m_wNumCharaList!=0){
#ifdef _UNICODE
int num = m_wNumCharaList/2;
m_pCharaList = new WCHAR[num+1];
for(int i = 0; i <= num;i++ ){
m_pCharaList[i] = vc.m_pCharaList[i];
}
#else
int num = m_wNumCharaList;
m_pCharaList = new char [num+1];
for(int i = 0; i<= num; i++){
m_pCharaList[i] = vc.m_pCharaList[i];
}
#endif
}

...

}


WORD m_wNumCharaList;


#ifdef _UNICODE
WCHAR* m_pCharaList;
#else
char* m_pCharaList;
#endif

};
class KiwiIndexFrmData
: public KiwiIndexFrm
{
public:

KiwiIndexFrmData();
virtual ~KiwiIndexFrmData();

private:


vector <VolRec*> m_vVolRec;

protected:

bool LoadVolRec(const LPBYTE pb,const DWORD& offset);
};
.cpp file
KiwiIndexFrmData::KiwiIndexFrmData()
{
// ToDo: Add your specialized code here and/or call the base class
}


KiwiIndexFrmData::~KiwiIndexFrmData()
{
// ToDo: Add your specialized code here and/or call the base class

int szVOLRec = m_vVolRec.size();
if(szVOLRec!=0){
for(int i = 0; i < szVOLRec; i++){

delete m_vVolRec[i];

}
m_vVolRec.clear();
}
}


bool KiwiIndexFrmData::LoadVolRec(const LPBYTE pb, const DWORD &offset)
{

bool bRet = true;


for(int i = 0;i < ulNumVOLRec;i++ ){

VolRec* vc = new VolRec;//KiwiIndexFrmData.cpp(320) memory leak
...
#ifdef _UNICODE



WORD num = vc->m_wNumCharaList/2; if(num!=0){
vc->m_pCharaList = new WCHAR [num+1];//KiwiIndexFrmData.cpp(338) memory leak
for(WORD i = 0; i < num; i++)
{
::memcpy((void*)(vc->m_pCharaList+i),
(void*)(pb+ofVOL+offlocal), sizeof(WCHAR));

kpt.WORDInvert_per4bit(vc->m_pCharaList[i]);

offlocal = offlocal + sizeof(WCHAR);

}
vc->m_pCharaList[num] = '\0';

}

#else
WORD num = vc->m_wNumCharaList/2;
WCHAR* pwc = new WCHAR [num+1];
for(WORD i = 0; i < num; i++)
{
::memcpy((void*)(pwc+i),
(void*)(pb+ofVOL+offlocal), sizeof(WCHAR));

kpt.WORDInvert_per4bit(pwc[i]);

offlocal = offlocal + sizeof(WCHAR);

}
pwc[num] = '\0';
vc->m_pCharaList = new char [2*num+1];
::WideCharToMultiByte(CP_ACP, 0,
pwc,num+1,vc->m_pCharaList,2*(num+1),NULL,NULL);

delete [] pwc;

#endif

...

m_vVolRec.push_back(vc);

}

return bRet;
}


:\src\KiwiIndexFrmData.cpp(338) : {7517} normal block at 0x00EFFE50, 8 bytes long.
Data: <! Br > 21 E2 E1 8C 42 72 00 00
\src\KiwiIndexFrmData.cpp(320) : {7516} normal block at 0x00EF8FA0, 72 bytes long.
Data: < b DVCRDSRC> 84 62 04 10 CD CD CD CD 44 56 43 52 44 53 52 43
Object dump complete.
The thread 0x7C8 has exited with code 0 (0x0).