Refs #3901 

Feedback from Dave's review.
Refs #3091

Gah!  The "device" variable isn't used at all in this loop (my eye
glossed over the next line and thought that "device" was used in the
free() statement, but it's actually "devices" -- not "device").