Fix malloc/delete mismatch