Fix GTS database memory leak.