DeviceManager: Use a sane Singleton implementation.

Also fixes valgrind complaints about unreleased memory at shutdown.

Change-Id: I5e347e991a135527afb58af1344d35ecee6917b9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>