]> git.tue.mpg.de Git - paraslash.git/commitdiff
play.c: Check whether filter ->close() is NULL.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 28 Jun 2015 14:21:23 +0000 (16:21 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 3 May 2016 23:01:45 +0000 (01:01 +0200)
While audiod.c and filter.c test whether ->close is NULL
before they attempt to call the function, play.c calls ->close()
unconditionally. This does not matter because all filters provide the
close method. But it is documented in filter.h that ->close may be
NULL. To avoid future surprises and to be consistent with para_audiod
and para_filter, let's change play.c to check for NULL as well.

play.c

diff --git a/play.c b/play.c
index 55c9ec1bbb635946fe8ec92eadb52fa0accc8bf6..927f5dc69df9c8a44d60c5d7221c626ccc0efaea 100644 (file)
--- a/play.c
+++ b/play.c
@@ -277,7 +277,8 @@ static int eof_cleanup(struct play_task *pt)
        memset(&pt->wn, 0, sizeof(struct writer_node));
 
        task_reap(&pt->fn.task);
-       decoder->close(&pt->fn);
+       if (decoder->close)
+               decoder->close(&pt->fn);
        btr_remove_node(&pt->fn.btrn);
        free(pt->fn.conf);
        memset(&pt->fn, 0, sizeof(struct filter_node));