bareos: master 37b2bd81

Author Committer Branch Timestamp Parent
mvwieringen mvwieringen master 2016-05-08 18:43 master 6544312a Pending
Changeset dird: Fix memory leak with configure usage string.

As the old buffer was defined as static inside the
get_configure_parameter() function it means its scope is still active at
the time the daemon ends and it will never be freed and as such
smartalloc whines in the following way:

bareos-dir: smartall.c:414-0 Orphaned buffer: bareos-dir 10016 bytes at
6e6b68 from mem_pool.c:242

The new approach is to use a static global variable and a dynamic
allocate of the POOL_MEM buffer and an extra cleanup function
destroy_configure_usage_string() which is called from terminate_dird().
I also renamed the original function from get_configure_parameter() to
get_configure_usage_string() which describes the function a bit better.
mod - src/dird/dird.c Diff File
mod - src/dird/dird_conf.c Diff File
mod - src/dird/protos.h Diff File
mod - src/dird/ua_cmds.c Diff File