Platform SDK: Network Management

SnmpFreePdu

The WinSNMP SnmpFreePdu function releases resources associated with an SNMP protocol data unit (PDU) created by the SnmpCreatePdu or the SnmpDuplicatePdu function.

SNMPAPI_STATUS SnmpFreePdu(
  HSNMP_PDU PDU     // handle to the PDU to free 
);

Parameters

PDU
[in] Handle to the SNMP PDU to free.

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_PDU_INVALID The PDU handle is invalid.
SNMPAPI_OTHER_ERROR An unknown or undefined error occurred.

Remarks

If the application calls the SnmpClose or the SnmpCleanup function, the Microsoft WinSNMP implementation frees all resources it allocates for the WinSNMP session. However, it is recommended that the application free individual resources with the WinSNMP function that corresponds to the resource. This reduces the implementation's work load, and should enhance the implementation's service to all applications. The application should use the SnmpFreeVbl function to deallocate variable bindings list resources. For additional information, see WinSNMP Data Management Concepts.

Under WinSNMP, a variable binding entry exists only within a variable bindings list, even if the variable bindings list contains just one entry.

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, SnmpFreeVbl, SnmpClose, SnmpCleanup