Add ui_finalize(), free string (patch by Dimitar Zhekov, thanks).