> the same way. I changed them (1st question was this correct in doing?) to
> str_dup's instead of just assignments. Still not working. So I looked
Yeah, the create_'s are where they are most necessary.
str_dups are a two-edged sword.. they can also cause memory leaks if you use
them on a string that will never be freed. So I'd look at what happens to
the places you assign them to.
> void free_string( char *pstr )
> {
> if ( pstr == NULL
>
> || pstr == &str_empty[0]
> || ( pstr >= string_space && pstr < top_string ) )
> return;
>
> free_mem( pstr, strlen(pstr) + 1 );
> return;
> }
It looks right.. though I'm no expert on godwars.
> now I can see how it's checking the pstr sent to it but I don't see where
> string_space and top_string come from.
Those should have been defined in db.c at boot time to mark the boundaries of
the memory chunk that holds shared strings..so basically shared strings are
never freed.
> Also, why free the length of the string plus one?
null terminator
--Palrich.