From: Andre Noll Date: Sun, 23 May 2010 17:02:06 +0000 (+0200) Subject: fecdec_filter: Simplify clear_group(). X-Git-Tag: v0.4.3~20^2~1 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=d482305cd2ffba049a7987a73d541c5b901a0d49;hp=ffb2eaa90429f6d5c3d369509efcdf91c5463dad;ds=sidebyside fecdec_filter: Simplify clear_group(). 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. --- diff --git a/fecdec_filter.c b/fecdec_filter.c index 10f1c642..195dbaae 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -102,18 +102,11 @@ static void clear_group(struct fecdec_group *fg) { 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,