rgui: Fix potential memory leak
Merge pull request #1147 from lioncash/leaks

rgui: Fix potential memory leak