A South African judge has scrapped a five-year jail sentence against the ex-wife of former president Nelson Mandela, Winnie Madikizela-Mandela.