Someone know how can I do [color:#33FF33]a memory allocation[/color] for an INPCameraFrame object With Microsoft COM interfaces? Thank you for your help

Actually the code crashes in [color:#FF0000]red line[/color] because of the [color:#33FF33]green instruction[/color].
#include "stdio.h"
#include "stdlib.h"
#include "optitrack.h"
//OpenCV
#include
#include
#include
INPCameraCollection *pCameraCollection;
INPCamera *pCamera;
INPCameraFrame *pFrame;
INPVector *pVector;
#define HRCHECK(message) if (FAILED(hr)) { fprintf(stderr, "%s\n", message); return 0; }
int main(int argc, char* argv[])
{
HRESULT hr;
LONG count;
LONG misc;
LONG waittime;
printf("Hello World!\n");
CoInitialize(NULL); // Startup Microsoft crap
// create CameraCollection and Vector objects:
hr = CoCreateInstance(__uuidof(NPCameraCollection), NULL, CLSCTX_ALL,
__uuidof(INPCameraCollection), (void **) &pCameraCollection);
HRCHECK("CoCreateInstance for CameraCollection");
hr = CoCreateInstance(__uuidof(NPVector), NULL, CLSCTX_ALL,
__uuidof(INPVector), (void **) &pVector);
HRCHECK("CoCreateInstance for Vector");
[color:#33CC00]hr = CoCreateInstance(__uuidof(NPCameraFrame), NULL, CLSCTX_ALL,
__uuidof(INPCameraFrame) , (void **) &pFrame);
HRCHECK("CoCreateInstance for CameraFrame");[/color]
// find all the cameras:
hr = pCameraCollection->Enum();
HRCHECK("CameraCollection->Enum");
hr = pCameraCollection->get_Count(&count);
HRCHECK("CameraCollection->get_Count");
if (count Item(0, &pCamera);
HRCHECK("CameraCollection->Item");
hr = pCamera->get_SerialNumber(&misc);
HRCHECK("Camera->get_SerialNumber");
printf("serial number = %ld\n", misc);
hr = pCamera->Open();
HRCHECK("Camera->Open");
#if 0
voption.vt = VT_BOOL;
voption.boolVal = VARIANT_TRUE;
hr = pCamera->SetOption(NP_OPTION_SEND_EMPTY_FRAMES, voption);
HRCHECK("Camera->SetOption");
#endif
hr = pCamera->Start();
HRCHECK("Camera->Start");
pVector->Reset();
HRCHECK("Vector->Reset");
LONG running = 600; // run ~1 minute for waittime=10 ms
while(running--) {
//Sleep(1);
waittime = 10; // value in milliseconds; 0 = don't wait; INFINITE = wait till data
hr = pCamera->GetFrame(waittime, &pFrame);
if (FAILED(hr)) {
fprintf(stderr,"Camera->GetFrame %x ", hr);
printf("Problem");
switch(hr) {
case E_POINTER:
fprintf(stderr, "E_POINTER\n"); break;
case NP_E_DEVICE_DISCONNECTED:
fprintf(stderr, "NP_E_DEVICE_DISCONNECTED\n"); break;
case NP_E_DEVICE_NOT_SUPPORTED:
fprintf(stderr, "NP_E_DEVICE_NOT_SUPPORTED\n"); break;
case HRESULT_FROM_WIN32(ERROR_TIMEOUT):
fprintf(stderr, "HRESULT_FROM_WIN32(ERROR_TIMEOUT)\n");break;
default:
fprintf(stderr, "default\n"); break;
}
}
//**************************** if hr == S_OK *********************************
if(pFrame==NULL){
printf("?");
}
else{
printf(".");
[color:#FF0000]hr = pVector->Update(pCamera, pFrame);[/color]
HRCHECK("Vector->Update");
VARIANT_BOOL pVal;
hr= pFrame->get_IsCorrupt(&pVal);
hr = pFrame->Free();
}
}//End of loop
printf("\nFin\n");
// shut everything down
pCamera->Stop();
pCamera->Close();
CoUninitialize();
return 0;
}