[En-Nut-Discussion] Bug In NutThreadCreate
Mike Cornelius
mikec at call-direct.com.au
Wed Feb 18 07:32:06 CET 2004
Hi All,
I have found a bug in NutThreadCreate:-
NutEnterCritical();
paddr = (const u_short *) fn; // *KU* fn doesn't contain the entry
address
// of the thread!
/*
* Allocate stack and thread info structure in one block.
*/
if ((threadMem = NutHeapAlloc(stackSize + sizeof(NUTTHREADINFO))) == 0)
return 0;
The above live should read:-
if ((threadMem = NutHeapAlloc(stackSize + sizeof(NUTTHREADINFO))) == 0){
NutExitCritical();
return 0;
}
Or else if you're out of memory you'll end up with a corrupted stack.
Regards,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
Mike Cornelius Internet: mikec at call-direct.com.au
Call Direct Cellular Solutions Phone: +61 2 9209-4259
Suite 145 FAX: +61 2 9209-4196
National Innovation Centre URL: http://www.call-direct.com.au
Australian Technology Park
Eveleigh NSW 1430
Australia
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
More information about the En-Nut-Discussion
mailing list