crash after delete snmpx
Jochen Katz
katz____agentpp.com
Sat Apr 14 02:15:28 CEST 2001
Hi,
> I have a class for SNMP agent derived from our own thread class. In the
> constructor of this class, I initialize the snmp session object to 0, and
> from my code I call the initialize() to create the snmp session. If
> everything goes fine, it works fine. Suppose the SNMP session could not be
> created, say due to bind failure. As I have allocated the snmp session
> object, I want to free the memory using delete operator for that object
> pointer. At this point the application crashes. I use winNT4.0 and VC++ 6.0.
> When I tried to debug it, I found that the memory content for the session
> object changes when it enters the destructor of Snmp class. In the ~snmp(),
> since the construct_status is not SNMP_CLASS_SUCCESS, it returns without
> doing clean up.
This is ok, as nothing has to be done. And doing nothing in a
destructor should not lead to a crash.
> As soon as it returns it crashes. I could not get much help
> why it's happening.
So a printf right after the delete isn't executed?
Best regards,
Jochen
More information about the AGENTPP
mailing list