Fix freeing pointer