Hi,
I am writing an Extensible Agent for Windows CE Platform.

I want to send Mac Address and a Value (Int) With Conveys some
information to the Manager with every Trap Packet I send.

So,
SnmpVarBind * VarPtr ;
extern char MyMacAddress [ ] ;


VariableBindingsList.len = 2;
VarPtr = VariableBindingsList.list = (RFC1157VarBind*)
SnmpUtilMemAlloc(sizeof(RFC1157VarBind) * VariableBindingsList.len);
if (VarPtr != (RFC1157VarBind *) NULL) {
VarPtr -> name.idLength = TrapOid.idLength;
VarPtr -> name.ids = (UINT *)SnmpUtilMemAlloc(sizeof (UINT) *
VarPtr-> name.idLength);
if (VarPtr->name.ids != (UINT *)NULL) {
memcpy (VarPtr -> name.ids, TrapOid.ids, sizeof
(UINT) * VarPtr -> name.idLength) ;
VarPtr -> value.asnType = ASN_INTEGER;
VarPtr -> value.asnValue.number = 0 ;
VarPtr++ ;
}
ValPtr -> name.idLength = MacOid.idLength;
VarPtr -> name.ids = (UINT *) SnmpUtilMemAlloc
(sizeof(UINT) * VarPtr ->name.idLength );
if (VarPtr->name.ids != (UINT *) NULL) {
memcpy (VarPtr -> name.ids, MacOid.ids,
sizeof(UINT) * VarPtr->name.idLength);
VarPtr -> value.asnType = ASN_OCTETSTRING ;
VarPtr -> value.asnValue.string.stream = (BYTE *)
SnmpUtilMemAlloc(sizeof(BYTE) * (strlen (MyMacAddress) + 1)
);
if (VarPtr -> value.asnValue.string.stream) {
VarPtr -> value.asnValue.string.length = strlen
(MyMacAddress) ;
strcpy ( (char *) VarPtr-> value.asnValue.string.stream,

MyMacAddress) ;
VarPtr -> value.asnValue.string.dynamic = TRUE ;
}
}

I am making value.asnValue.string.dynamic = TRUE

So that when the event is triggerred the Master AGent Frees it.


But When I run the Agent, I Have a Feeling that Some Where Some Memory
Leak is Taking Place.

I just wanted to know if in the above Code Memory Leak is taking
Place.

Please Help.

Regards,
Nic