Platform SDK: Active Directory, ADSI, and Directory Services

FreeADsMem

The FreeADsMem function frees the memory previously allocated by AllocADsMem.

BOOL FreeADsMem(
  LPVOID pMem 
);

Parameters

pMem
Pointer to the local memory to be freed.

Return Values

The function returns FALSE if the memory is not allocated by AllocADsMem. Otherwise, it return TRUE.

Remarks

In ADSI, all method-allocated memory must be freed using FreeADsMem. For example,

LPWSTR pszColumn;
m_pSearch->GetFirstRow(hSearch);
printf("Column names are: ");
while(m_pSerach->GetNextColumnName(hSearch, &pszColumn) !=
                                      S_ADS_NOMORE_COLUMNS) {
    printf("%S ", pszColumn);
    // method-allocated memory, pszColumn, must be freed before
    // the pointer variable is used in the next GetnextColumnName call.
    FreeADsMem(pszColumn);
}

Requirements

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
  Windows 95/98: Requires Windows 95 or later (with DSClient).
  Header: Declared in Adshlp.h.
  Library: Included as a resource in ActiveDs.dll.

See Also

ADSI Functions, AllocADsMem