Notes C API crash

I create an add-in Domino task app. The app call the Notes C API with multi-thread.

Code:

WORD messageLen;

SCHMSG* pMessage = NULL;

HCNTNR hContainer = NULL;

STATUS status1 = MQGet(hInputQueue (char*)pMessage, sizeof(SCHMSG), MQ_WAIT_FOR_MSG, 5000, &messageLen);

STATUS status2 = SchContainer_DupHandle(pMessage->hMsgCntnr, &hContainer);

/******** do something *********/

SchContainer_Free(hContainer);

Error:

The hContainer can not free sometimes when i called the Notes C API SchContainer_Free(hContainer) and sometimes the Task and the Domino will crash.

Why can’t I release the hContainer?

Any help is welcome!