fixes missing frees in case of abnormal return in read_gauge