I am programming a C application with eclipse when happens a strange event.
I have a function to which I pass a pointer to struct, then inside of function, I allocate to this pointer other pointer of same type, a simple allocation like this
pointer = otherPointer;
Then, magically, my allocation is completely ignored by the program. I have refined with gdb and I see like the program pass for this line and the instruction is ignored.
there are some people with idea of causes of this paranormal event?
In the program there are similar functions with similar behavior and the allocation is done correctly.
Here is the funciton in question:
void uah_pcb_extract_queue_head (struct UAH_PCB * pPCB, struct UAH_PCB_Queue * pQueue)
{
if (pQueue->head->next != NULL)
{
pPCB = pQueue->head;
pQueue->head = pQueue->head->next;
}
else if (pQueue->head != NULL)
{
pPCB = pQueue->head;//this allocation
pQueue->head = NULL;//in this line the value has not changed
pQueue->tail = NULL;
}
else
{
pPCB = NULL;
}
}