Freeing Peer Data
All pointers that the Peer Infrastructure functions return must be freed by using PeerGraphFreeData or PeerFreeData. These functions must only be called for structures that are directly returned by a Peer Infrastructure function. Do not call a different FreeData function to free nested pointers, for example, do not call a FreeData function on the pointers in a PEER_RECORD structure.
The following code snippet shows you how to retrieve the properties associated with a graph, and then free the data that is returned.
PEER_GRAPH_PROPERTIES * pGraphProperties = NULL;
HRESULT hr = PeerGraphGetProperties(hGraph, &pGraphProperties);
if (SUCCEEDED(hr) && (NULL != pGraphProperties))
{
// use pGraphProperties
wprintf(L"%d\n", pGraphProperties->pwzGraphId);
// release the data
PeerGraphFreeData(pGraphProperties);
}