Use the VgwStreamFreeFnc function to release resources, such as memory for data structures, acquired by your stream. The Verity engine calls your VgwStreamFreeFnc function when it receives a VdkTokenType_Eof token from the VgwStreamGetTokenFnc function associated with the stream.


VdkError VgwStreamFreeFnc(
VgwAppStream   vgwStream)




VgwAppStream   The stream handle, which was created in your driver’s VgwStreamNewFnc function.


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



In addition to the Verity engine calling your VgwStreamFreeFnc function when there are no more tokens in the stream, you can call VgwStreamFreeFnc also; for example, if your VgwStreamNewFnc function results in an error, you may need to free resources allocated in VgwStreamNewFnc before terminating.

If your VgwStreamFreeTokenFnc callback function did not free all tokens, you must free them in your VgwStreamFreeFnc function. For example, if you created all tokens in your gateway driver’s VgwStreamNewFnc function and used your driver’s VgwStreamGetTokenFnc function only to submit tokens to the Verity engine, you could release the tokens in your VgwStreamFreeFnc function.

You should free your stream data, referenced by vgwStream, after first releasing all other resources referenced by this stream handle.


static VdkError
VDK_CALLBACK VgwStreamFree(VgwAppStream pStream)
if (!pStream)
return VdkSuccess;

* free the data created in VgwStreamNew

if (pStream->key)
if (pStream->field)

return VdkSuccess;