fix another use-after-free in devices.c

I missed one variant in 0d6921aa64dafa990cdc6fcbdf1589a8ace82a69