Fix allocation/deallocation mismatch