|
From: | Alexandre Malo |
Subject: | [lwip-users] memory leak when sending snmp trap |
Date: | Wed, 10 Jun 2009 16:58:53 -0400 |
Hello,
I am having memory leak with a task
sending trap.
Here is my simple task:
#define MY_SNMP_ENTERPRISE_ID
4464
#define MY_SNMP_SYSOBJID_LEN 7 #define MY_SNMP_SYSOBJID {1, 3, 6, 1, 4, 1, MY_SNMP_ENTERPRISE_ID} void vSendTrapTask( void * pvParameters
)
{ portTickType xLastWakeTime; struct snmp_obj_id objid = {MY_SNMP_SYSOBJID_LEN, MY_SNMP_SYSOBJID}; struct snmp_varbind *vb; static unsigned char msg[] = "address@hidden"; static unsigned char msglen= 22; (void)
pvParameters;
for ( ;; ) { xLastWakeTime = xTaskGetTickCount(); vb = snmp_varbind_alloc(&objid, SNMP_ASN1_OPAQUE, msglen); vb->value = &msg; trap_msg.outvb.head = vb; trap_msg.outvb.tail = vb; trap_msg.outvb.count = 1; snmp_send_trap(SNMP_GENTRAP_ENTERPRISESPC, &objid, 0); trap_msg.outvb.head = NULL; trap_msg.outvb.tail = NULL; trap_msg.outvb.count = 0; vb->value = NULL; snmp_varbind_free(vb); // Wait for the next cycle. vTaskDelayUntil( &xLastWakeTime, 10 ); } } Do I use correctly snmp_varbind_alloc?
I want to notify that the thread works for a random
number of sent trap. I tried it more than once and its never the same amount of
trap that is received.
Thanks!
Alexandre Malo
|
[Prev in Thread] | Current Thread | [Next in Thread] |