Re: [Win32] pthreads and memory allocationby Marshall (Monsignor)
|on Nov 22, 2011 at 06:20 UTC||Need Help??|
I am having trouble understanding even the basics of this C code.
TaskCode() returns a pointer to anything and accepts a pointer to anything.
There is nothing returned from this C subroutine,
The OP's code is a memory leak because there is no pointer or other way to use the memory allocated by
"s" is a memory pointer returned by malloc(). Now a malloc() call should have a conditional statement to see that it actually worked. But the big thing here is that the subroutine TaskCode() returns bullshit. I don't see how "s", the pointer to a new memory allocation of 100 bytes can ever be used outside of TaskCode()