play: Fix segfault if decoder is not supported.
authorAndre Noll <maan@systemlinux.org>
Mon, 19 Nov 2012 21:51:50 +0000 (22:51 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 19 Nov 2012 21:51:50 +0000 (22:51 +0100)
When paraslash was build without libmad, para_play still recognizes mp3
files (because the mp3 audio format handler does not require libmad),
but decoding fails of course.

Specifically, the check_filter_arg() call in load_file() fails, but
the error handling code misses to clear the receiver node structure,
which results in a subsequent seqfault due to a double free.

This patch calls wipe_receiver_node() instead of open coding the
cleanup. This fixes the bug and actually simplifies the code a bit.

play.c

diff --git a/play.c b/play.c
index 7537ddd..047c959 100644 (file)
--- a/play.c
+++ b/play.c
@@ -427,9 +427,7 @@ static int load_file(struct play_task *pt)
        register_writer_node(&pt->wn, pt->fn.btrn, &sched);
        return 1;
 fail:
-       afh_recv->close(&pt->rn);
-       btr_remove_node(&pt->rn.btrn);
-       afh_recv->free_config(pt->rn.conf);
+       wipe_receiver_node(pt);
        return ret;
 }