[config] fix mem leaks in config parser