Won't `cert` be leaked here (and in the next error condition)?