app/testpmd: fix crash when attaching a device