fix the valgrind memory leak in ch_log.c