The code was duplicated in various places, replaced with calls to a new function, multires_customdata_delete().