This example frees memory allocated (by WinGetErrorInfo) for an error-information block using WinFreeErrorInfo.
#define INCL_WINERRORS /* Window Error Functions */ #include <os2.h> BOOL fSuccess; /* success indicator */ ERRORID erridErrorCode;/* last error id code */ PERRINFO perriErrorInfo;/* error info structure */ HAB hab; /* anchor-block handle */ /* obtain error block and assign error code */ perriErrorInfo = WinGetErrorInfo(hab); erridErrorCode = perriErrorInfo->idError; /* free error block */ fSuccess = WinFreeErrorInfo(perriErrorInfo);