array: re-initialize the array in pw_array_clear()

Leaving the data nonzero is a use-after-free bug waiting to happen.
This commit is contained in:
Peter Hutterer 2021-10-07 12:50:02 +10:00
parent 7123fadc37
commit e36183d3cf
2 changed files with 30 additions and 0 deletions

View file

@ -98,6 +98,7 @@ static inline void pw_array_init(struct pw_array *arr, size_t extend)
static inline void pw_array_clear(struct pw_array *arr)
{
free(arr->data);
pw_array_init(arr, arr->extend);
}
/** Reset the array */