FIX memory leak: cleanup free up heap allocated memory