fixed memory leak in add function (delete driver when it has an error)