[config] add some const qualifiers
[config] fix possible memory leaks