SnmpFreeContext

[This is preliminary documentation and subject to change.]

The WinSNMP SnmpFreeContext function releases resources associated with an SNMP context, which is a set of managed object resources.

SNMPAPI_STATUS SnmpFreeContext(
  HSNMP_CONTEXT context    // handle to the context to release 
);
 

Parameters

context
Handle to the SNMP context that will have its resources released.

Return Values

If the function succeeds, the return value is SNMPAPI_SUCCESS.

If the function fails, the return value is SNMPAPI_FAILURE. To get extended error information, call SnmpGetLastError. The SnmpGetLastError function can return one of the following errors.

Error Code Description
SNMPAPI_NOT_INITIALIZED The SnmpStartup function did not complete successfully.
SNMPAPI_ALLOC_ERROR An error occurred during memory allocation.
SNMPAPI_CONTEXT_INVALID The context parameter is invalid.
SNMPAPI_OTHER_ERROR An unknown or undefined error occurred.

Remarks

When the WinSNMP manager application calls the SnmpClose function or the SnmpCleanup function, the Microsoft WinSNMP implementation frees all resources it allocated for the WinSNMP session. However, it is recommended that the WinSNMP manager application free individual resources with the WinSNMP function that corresponds to the resource. For example, manager applications should call the SnmpFreeContext function to release resources allocated by a call to the SnmpStrToContext function. This reduces the implementation's work load, and should enhance the service of the implementation to all applications.

For additional information, see WinSNMP Data Management Concepts.

QuickInfo

  Windows NT: Requires version 5.0 or later. Available as a redistributable for Windows NT 4.0.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winsnmp.h.
  Import Library: Use wsnmp32.lib.

See Also

WinSNMP Manager API Overview, WinSNMP Functions, SnmpClose, SnmpCleanup, SnmpStrToContext