copy_service leaks memory when copying any P_LIST variable
that has an alias, e.g. hosts allow, allow hosts. This is
as the str_list_copy occurs once for each alias variant
and the already copied *dest_ptr is discarded before the
second copy takes place.
lp_save_defaults combats this with a test at the start of
its copying loop to make it skip aliased items, but
copy_service lacks this, presumably because theorerically
a copymap could have the bit set only on an alias's
parm_table entry and not on the aliased name - which would
result in it not being copied.
This appeared to cause a considerable leak on my system
which has a large number of services, large 'hosts allow'
lists, and a fairly regularly changing configuration file.
I will upload a patch against 3.0.3rc1 that combats this
by doing a str_list_free on any preexisting *dest_ptr
before performing another str_list_copy. I've looked
briefly at the callers of copy_service and it looks like
it should be safe.
Regards
Chris
--
Christopher Pascoe
IT Infrastructure Manager
School of Information Technology and Electrical Engineering
The University of Queensland Brisbane QLD 4072 Australia