demos: Minor cube/tri updates

Minor updates/fixes for cube and tri:
 - Break from demo_check_layers search loop when finding a match.
 - Skip memory allocation and layer/extension processing when 0
   layers/extensions are enumerated.
 - Fix potential NULL pointer dereference and exit with message when
   no accessible devices are available.
 - Fix device_extensions memory leak.
 - Remove trailing whitespace.
2 files changed