dmi_fields_release
Description
The dmi_fields_release function frees the arrays dmi_fields_decode has
allocated for a structure: the elements of every array the fields of its
specification declare, including the arrays held by nested structures, by the
elements of vectors and by the elements of other arrays, which are freed
before the array holding them. The decoded structure itself is left to the
caller.
The members holding the arrays are reset to nullptr, and the counters of the
decoded elements to zero, so the function may be called more than once, and a
structure whose decoding has failed half way is released the same way: an
element which has failed to decode has been released as it failed.
dmi_entity_decode, when decoding fails, and dmi_entity_destroy call
the function on their own, after the cleanup handler of the specification.
The handler therefore frees only what the handlers of the specification
allocate themselves, e.g. an array a deriving handler fills in, and may still
read the arrays the fields declare. The arrays of the structures the
references of the attributes are resolved into are freed before the handler,
by dmi_attributes_unlink, since the elements of those arrays may hold them.
A structure decoded by a decoding handler of its own is released only as far as its specification declares fields.