When you have finished with the PBCallInfo structure, call FreeCallInfo to release the memory allocated to it, then delete the structure, release the session, and free the library:
// Release Call Info session->FreeCallInfo(&ci); delete &ci; // Release session session->Release(); return 0; FreeLibrary(hinst); }