Fixed memory leak with data structure elements