[AGENT++] heap corruption when delete a dynamic Snmp object

Jochen Katz katz at agentpp.com
Thu Jul 22 22:25:37 CEST 2010


Hi,

I still think, that your projects do not match, because I just set up a
new snmp++ dll project from scratch and created an exe project with your
test code below and there is no error.

If you still don't believe me, do the following: Open your test code
project and remove the snmp++ dll from the linker settings, then add all
cpp files from the snmp++/src folder to the project and do a clean
recompile.

Regards,
  Jochen


Am 22.07.2010 03:55, schrieb Wang Fang:
> I think my project settings and the runtime dll are correct. I do a
> little more test, I think may the destructor function of Snmp has some
> problem. The test code are:
> #include "snmp_pp.h"
> void test()
> {
>     int status;
>     Snmp snmp(status);
> }
> int main()
> {
>     Snmp::socket_startup();
>     test(); // fail
>     return 0;
> }
> The error message are:
> A buffer overrun has occurred in SNMPTrapSender.exe which has
> corrupted the program's internal state. Press Break to debug the
> program or Continue to terminate the program.
> 
> For more details please see Help topic 'How to debug Buffer Overrun Issues'.
> 
> On Thu, Jul 22, 2010 at 3:45 AM, Jochen Katz <katz at agentpp.com> wrote:
>> Hi,
>>
>> please make sure that the settings of the project you used to build the
>> snmp++ library are identical to the settings of your test project. In
>> case you compiled snmp++ to a dll, verify that at runtime the right dll
>> is loaded.
>>
>> Regards,
>>  Jochen
>>
>>
>> Am 21.07.2010 14:04, schrieb Wang Fang:
>>> Hi
>>>
>>> I am using vc++ 2008 and SNMP++v3.2.24, the testing code are:
>>> #include "snmp_pp.h"
>>> int main()
>>> {
>>>     Snmp::socket_startup();
>>>     int status;
>>>     Snmp *p = new Snmp(status);
>>>     delete p;       // heap corruption
>>>     Snmp::socket_cleanup();
>>>     return 0;
>>> }
>>>
>>> The error message are:
>>> Windows has triggered a breakpoint in SNMPTrapSender.exe.
>>>
>>> This may be due to a corruption of the heap, which indicates a bug in
>>> SNMPTrapSender.exe or any of the DLLs it has loaded.
>>>
>>> This may also be due to the user pressing F12 while SNMPTrapSender.exe
>>> has focus.
>>>
>>> The output window may have more diagnostic information.
>>>
>> _______________________________________________
>> AGENTPP mailing list
>> AGENTPP at agentpp.org
>> http://lists.agentpp.org/mailman/listinfo/agentpp
>>
> 
> 
> 



More information about the AGENTPP mailing list