Yeah, calloc() will, but I didn't see where he called calloc() on pWrd. He called it on guesses, but not until after wordlist_cc() tried to access it. So unless I'm misunderstanding the entry points to the program, pWrd is not intialized and hence it can contain non-zero values.
Unless I overlooked something, which does happen when you read code for 8 hours a day every day :) > On Thu, 26 Aug 2004 10:56:04 -0500 (EST), > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> You never set pWrd->guess_count to 0, so it could be anything. If it >> happened to be 1, then this is probably going to coredump when it >> accesses >> pWrd->guesses[i] because you do not call calloc on that until >> do_wtcorrect(). > & >> A lot of people that learned other languages before C (like java) tend >> to >> forget that C will not initialize data for you. You need to set every >> variable before you can be sure what it is. Declaring an int does not >> mean it will equal 0. It /may/ but it is not guaranteed to be. > > With alloc_perm, it uses calloc which 0's everything, no? And free_x > should set it to if its done properly. Orrr, if the new_* is done > properly you should have a static variable, which is set to zero when > allocated, so it should all be zeroed... of course, if done properly > :P > > Davion > > -- > ROM mailing list > [email protected] > http://www.rom.org/cgi-bin/mailman/listinfo/rom >

