Memory leak in this case?

Joined
Feb 12, 2008
Messages
108
Reaction score
0
Hello everyone,


Suppose I have a component (class) CX implements IUnknown interface, and I have retrieved a pointer of CX by IUnknown pointer (IUnknown*), that is.

Code:
IUnknown* pCX;
QueryInterface (IID_IUnknown, &pCX);

//...

delete pCX; // memory and resource leak here?

Even if I declare the component CX's destructor as virtual, if I delete through IUnknown pointer to "release" the object, there is still potential memory and resource leak, because in IUnknown interface, destructor is the compiler provided default one, which is non-virtual and public, right?


thanks in advance,
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

resource leak in this case? 0
CComPtr 0
Memory Leak 5
CComVariant 0
FFI Memory Leak 4
memory leak in the code? 36
Does this constitute a memory leak? 8
Cannot understand this memory leak. 11

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,068
Latest member
MakersCBDIngredients

Latest Threads

Top