|
-
July 27th, 2011, 07:29 PM
#1
HEAP Error
There is an API that I need to call to fetch a VALUE (UID)
//declaration
RET_STATUS ActivateIdle(uint8_t *pabATQ = NULL,
uint8_t *pbSAK = NULL,
uint8_t *pabUID = NULL,
uint8_t *pbUIDLength = NULL);
when the API is called with no parameters (poRd700Wrapper->ActivateIdle() ) program terminates normally but when it is used with passing the Pointers , although I get to get my value that I want (UID) returned but I get a
HEAP CORRUPTION DETECTED. CRT detected that the application wrote to memory after end of heap buffer
Its been a while since I did work with pointers in C++ but from what it seems API is allocating stoarge that its not releasing upon its return;
Am i right about this ?
Code:
uint8_t *pabATQ= new uint8_t(0);
uint8_t *pbSAK = new uint8_t(0);
uint8_t *pabUID= new uint8_t(0);
uint8_t *pbUIDLength = new uint8_t(0);
// This Call seems to be OK
//if( ( retsReturnCode = poRd700Wrapper->ActivateIdle() ) != MI_OK )
// This Call Causes the crash.
if( ( retsReturnCode = poRd700Wrapper->ActivateIdle(pabATQ,pbSAK,pabUID,pbUIDLength))!= MI_OK) {
delete poRd700Wrapper;
poRd700Wrapper = NULL;
return NULL;
}
if(pbUIDLength)
{
if(pabUID != NULL)
{
uint8_t i;
for(i=0;i<*pbUIDLength;i++)
{
sprintf(textUID,"%s%02x ",textUID, *pabUID+i));
}
}
}
delete pabATQ;
delete pbSAK;
delete pabUID;
delete pbUIDLength;
Is there anything obvious that I don't see ?
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|