From: Andre Noll Date: Sat, 6 Jul 2013 21:00:14 +0000 (+0200) Subject: audiod: Close filters in reverse order. X-Git-Tag: v0.4.13~17 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=0a00efb460acb26324412aed66cc9a5ea0ebf860;ds=sidebyside audiod: Close filters in reverse order. Otherwise, a subsequent filter might refer to a buffer reference of the previous filter, accessing freed memory. This is not a bug right now, as audiod only closes filters after the full buffer tree has become inactive, i.e. after all buffer tree nodes have unregistered their task. It's cleaner to reverse the loop though, and it has no additional cost. --- diff --git a/audiod.c b/audiod.c index 8552af6b..8f2a72ac 100644 --- a/audiod.c +++ b/audiod.c @@ -428,7 +428,7 @@ static void close_filters(struct slot_info *s) struct audio_format_info *a = afi + s->format; if (a->num_filters == 0) return; - for (i = 0; i < a->num_filters; i++) { + for (i = a->num_filters - 1; i >= 0; i--) { struct filter_node *fn = s->fns + i; struct filter *f;