fecdec: Be more anal when finding fec groups.
[paraslash.git] / fecdec_filter.c
index a7d1875c271e8f8889d20eeff62a119ce11380d5..ee3d0d6eac595378f6f4a6380d5c93441602b3aa 100644 (file)
@@ -118,9 +118,9 @@ static int find_group(struct fec_header *h,
                if (fg->h.group_num != h->group_num)
                        continue;
                if (fg->h.slices_per_group != h->slices_per_group)
-                       continue;
+                       return -E_BAD_FEC_HEADER;
                if (fg->h.data_slices_per_group != h->data_slices_per_group)
-                       continue;
+                       return -E_BAD_FEC_HEADER;
                *result = fg;
                return 1;
        }
@@ -161,8 +161,8 @@ static struct fecdec_group *free_oldest_group(struct private_fecdec_data *pfd)
        }
        if (!group_complete(oldest) && !group_empty(oldest))
                PARA_WARNING_LOG("Clearing incomplete group %d "
-                       "(contains %d slices)\n", fg->h.group_num,
-                       fg->num_received_slices);
+                       "(contains %d slices)\n", oldest->h.group_num,
+                       oldest->num_received_slices);
        clear_group(oldest);
        return oldest;
 }
@@ -379,6 +379,7 @@ static void fecdec_close(struct filter_node *fn)
                clear_group(fg);
        free(fn->buf);
        fn->buf = NULL;
+       fec_free(pfd->fec);
        free(fn->private_data);
        fn->private_data = NULL;
 }