08-13-2010 08:10 AM
The struct of the chain as follows:
typedef struct _SHOW_DATA
{
int GainStates;
int ShowDataIsValid;
struct _SHOW_DATA *pNext;
}SHOW_DATA;
typedef struct _DATA_CHAIN
{
SHOW_DATA *pStart;
SHOW_DATA *pWrite;
}DATA_CHAIN;
Add list function:
void DataChain_Add(DATA_CHAIN *pChain,SHOW_DATA *pshowData)
{
if(pChain->pStart == NULL)
{
pChain->pStart = pshowData;
pChain->pWrite = pshowData;
FirstDataIn = TRUE;
}
else
{
pChain->pWrite->pNext = pshowData;
pChain->pWrite = pChain->pWrite->pNext;
}
}
pStart saves the starting pointer of the chain,pWrite pointer the end of the chain,using pshowData=malloc(sizeof(SHOW_DATA)) to add list 。When the list is not to long,pStart->pNext== 0x00FF3C20;the address is true,but as the list is longer,suddenly the address is changed,becomes 0x0000001E. So when I delete list,free the address 0x0000001E, of course I got a Error “attempt to free pointer to memory not allocated by malloc() or calloc()”.Who can help me?Thank you!!!
08-13-2010 08:35 AM
Hi,
please could you point out in how far this question is related to CVI? This is not a forum about the programming language C...
08-13-2010 08:44 AM
by the way, there NO need for multiple posts
08-13-2010 09:20 AM
I am so sorry, I thought I Posted in the Chinese section cannot being seen in the English section.
I think it is the bug of labwindows 2009,so I posted this question here. however ,I will continue to research this question