[PATCH v3 2/2] kunit: avoid memory leak on device register error