[Freeciv-Dev] Re: Ruleset Question
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
=?BIG5?B?vbKr7bXY?= <iquin@xxxxxxxxxx> wrote:
> Is the caller responsible for free()ing memory returned by
> secfile_lookup_str_default()?
No, the lookup_str functions return a pointer into to the internal
registry data structures, which should definitely not be freed by the
caller. (They are free-d in section_file_free(); actually, if you tried
it free() would probably segfault or similar, because the strings are
actually pointers into an sbuffer, rather than individually malloced
objects.)
secfile_lookup_str_vec() is a bit different but has a comment which
explains things (and in passing implies the above).
-- David
|
|