Fix abundant memory leaks in measures2csv.