examples: fix memory leak

Free used resources before exiting.

Change-Id: If6cde6541615fbf17bf56ed335b76e676eabba93
2 files changed