On Sat, Feb 26, 2011 at 5:48 PM, Adam Mendlik <[email protected]> wrote:

> Here is a simple demo I put together that exemplifies the problem I'm
> seeing. If you run this code as-is, memory use will increase indefinately.
> However, if you take out the snmp_send() call and just call snmp_free_pdu(),
> memory use will remain perfectly flat. I should also mention that my
> netsnmp.lib is built with HAVE_WIN32_PLATFORM_SDK and
> NETSNMP_DISABLE_MIB_LOADING.
>
> [ ... ]
>
> void test_send(netsnmp_session *ss)
> {
>     netsnmp_pdu    *pdu;
>     pdu = snmp_pdu_create(SNMP_MSG_TRAP);
>     // On error, we must free the PDU ourselves
>     if (snmp_send(ss, pdu)) {
>         snmp_free_pdu(pdu);
>         printf("\nERROR");
>     }
> }
>

snmp_send() returns zero upon error and a non-zero value upon success, so
"== 0" should be inserted at the end of the expression in the if-statement.
Does that help ?

Bart.
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to