There is no point in invalidating the index and data pointers if we are about
to free them anyway. So just set the whole thing to zero. This is easier and
does not require modifications if struct fecdec_group changes.
{
int i;
- for (i = 0; i < fg->num_slices; i++) {
+ for (i = 0; i < fg->num_slices; i++)
free(fg->data[i]);
- fg->data[i] = NULL;
- fg->idx[i] = -1;
- }
free(fg->data);
- fg->data = NULL;
free(fg->idx);
- fg->idx = NULL;
- fg->num_slices = 0;
- memset(&fg->h, 0, sizeof(struct fec_header));
- fg->num_received_slices = 0;
+ memset(fg, 0, sizeof(*fg));
}
static int find_group(struct fec_header *h,