memory leak; program terminates

Hi,
I have been trying to add a MIB parsing capability to my COM object. To get started with libsmi, I have implemented this very simple thing:
1) Add a method on a COM interface that would merely load MIB modules, like so:
STDMETHOD CSomeCOClass::LoadMIB(BSTR MIBFileName) {
char *modulename; char szFileName[MAX_PATH];
WideCharToMultiByte(CP_ACP, 0, MIBFileName, -1, szFileName, MAX_PATH, NULL, NULL);
modulename = smiLoadModule( szFileName);
return S_OK; }
2) Add a call to smiInit() from within the object's initialisation method.
3) Now, a COM client application is performing a series of calls to the method presented above (LoadMIB), each time passing to it a different MIB module (some standard RFC modules).
(A note: the next step would be of course to use further libsmi's APIs to provide actual parsing for the pre-loaded MIBs, but at this time I have been trying to realize whether I can successfully load a decent number of MIB modules.)
The problem is that at some point, after (what seems to be a successful) loading of several MIB files, Visual C++ warns on memory leak and the program is terminated.
My question is, am I missing something in the sample above, is there any other libsmi API that should have been called in addition to smiInit() and smiLoadMOdule() to make it properly load MIB files?
Thanks, Arie. -- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.

1) smiInit() 2) some work 3) smiExit()
I assume that you omitted smiExit().
-- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.

Hi Arie!
What you have done so far (smiInit() and several calls to smiLoadModule()) is correct. I don't know how C++ runtime systems behave with respect to memory leaks. I cannot guarantee that there are no more leaks in the libsmi code (in fact, I'm quite sure that there are still some minor leaks not yet fixed). But I wonder why your runtime system terminates the program for this reason.
-frank -- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To subscribe or !! unsubscribe, send a mail message to libsmi-request@ibr.cs.tu-bs.de. !! See http://www.ibr.cs.tu-bs.de/projects/libsmi/ for more information.
participants (3)
-
Arie Trost
-
Frank Strauss
-
Kang, Jeongwon