config.c: fix mmap leak when writing config