Fix: double free when both mmap and read fail