"Nadav Har'El" <[EMAIL PROTECTED]> writes: > What is this last return statement?? Returning from main? That's not > something you're supposed to do in a multithreaded program. It > might, for example, free the entire malloc pool, including arg which > is later freed in the second thread, causing a segmentation fault.
You are right that there should not be a return statement, but it is not what is happening: free() is OK, according to the debugger. Besides, return from main(), as well as any exit(), should terminate the process (including any threads), freeing the memory by independent means, not execute the rest of the code, buggy as it may be. > Try replacing "return EXIT_SUCCESS" by "pause()" (for example) and see > if it now works. Tried it, with pause() or without - did not help. -- Oleg Goldshmidt | [EMAIL PROTECTED] If it aint't broken it hasn't got enough features yet. ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]