Platform SDK: Network Management

SnmpFreeDescriptor

A WinSNMP application uses the SnmpFreeDescriptor function to inform the Microsoft WinSNMP implementation that it no longer requires access to a descriptor object. This WinSNMP function signals the implementation to free the memory it allocated for the descriptor object.

SNMPAPI_STATUS SnmpFreeDescriptor(
  smiUINT32 syntax,       // data type of target descriptor object
  smiLPOPAQUE descriptor  // pointer to the target descriptor object
);

Parameters

syntax
[in] Specifies the syntax data type of the target descriptor object.
descriptor
[in] Pointer to an smiOPAQUE structure that contains the target descriptor object to release.

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 specifying a NULL value in its session parameter. 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_SYNTAX_INVALID The syntax parameter is invalid.
SNMPAPI_OPERATION_INVALID The descriptor parameter is invalid. For additional information, see the following Remarks section.
SNMPAPI_OTHER_ERROR An unknown or undefined error occurred.

Remarks

The implementation allocates and deallocates memory for output descriptor objects with variable lengths. This memory allocation and deallocation are restricted to the implementation, except for the interface that the SnmpFreeDescriptor function provides. For additional information, see Freeing WinSNMP Descriptors.

The implementation returns the SNMPAPI_OPERATION_INVALID error code if the descriptor parameter specifies a memory allocation that the implementation released in a prior call to SnmpFreeDescriptor. The function returns the same error code if the descriptor parameter specifies a memory allocation that the implementation did not make for the calling WinSNMP application.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winsnmp.h.
  Library: Use Wsnmp32.lib.

See Also

WinSNMP API Overview, WinSNMP Functions, SnmpStrToOid, SnmpOidCopy, SnmpEncodeMsg