tsg: fix possible free of initialized memory