VgwSessionGetInfoFreeFnc


Use the VgwSessionGetInfoFreeFnc function to free all resources associated with the session information handle. The Verity engine calls your VgwSessionGetInfoFreeFnc function after it obtains information about the session via calling the VgwSessionGetInfoFnc function.


Syntax

VdkError VgwSessionGetInfoFreeFnc(
   VgwSessionInfoOut   vgwSessionInfoOut)

Arguments

 


vgwSessionInfoOut

VgwSessionInfoOut   A session information packet handle.


Returns

This function must return one of the following error codes:

VdkSuccess for success

 

VdkError_* for a standard Verity Developer Kit API error as described in the Verity Developer’s Kit Programming Reference

 

VdkFail for a non-specific error

 


Discussion

You should free your information packet, referenced by the input parameter, vgwSessionInfoOut, after first releasing all resources associated with it. Your VgwSessionGetInfoFreeFnc function should free the information packet handle in the same way that it was allocated in the VgwSessionGetInfoFnc function; for example, if the handle was created in the heap, it should be freed from the heap.


Example

static VdkError
VDK_CALLBACK VgwSessionGetInfoFree(VgwSessionInfoOut pInfo)
{
if (!pInfo)
return VdkSuccess;

/*************************************
* free gateway repository array here
*************************************/

if (pInfo->repositoryArray) {
for( ; (pInfo->repositoryCount-- > 0); ){
if (!pInfo->repositoryArray[pInfo->repositoryCount])
continue;

free(pInfo->repositoryArray[pInfo->repositoryCount]);
pInfo->repositoryArray[pInfo->repositoryCount] = NULL;
}
free(pInfo->repositoryArray);
}

/****************************************************
* free the info object created in VgwSessionGetInfo
****************************************************/

free(pInfo);
return VdkSuccess;
}