logger: fix memory leak when log_enable is 0. closes #886