You need to delete the device here otherwise it leaks memory.