Fix CID 1238665 and 1241777 aka memory leak and out of bounds write in flirt