From f4b90d1c56f3dfb5e5214fd076df47202f1c69c6 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 9 Mar 2014 15:21:48 +0100 Subject: [PATCH] ao_write: Call ao_initialize() only once. It is possible that another instance of the ao writer is active when aow_close() is called. Calling ao_shutdown() in ao_close() might disturb the other instance and lead to a segmentation fault. Fix this by calling ao_initialize() only once during aow_init() and never call ao_shutdown() any more. --- ao_write.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/ao_write.c b/ao_write.c index 4281f536..63d18afa 100644 --- a/ao_write.c +++ b/ao_write.c @@ -44,7 +44,6 @@ static void aow_close(struct writer_node *wn) ao_close(pawd->dev); free(pawd); wn->private_data = NULL; - ao_shutdown(); } static void aow_pre_select(struct sched *s, struct task *t) @@ -158,7 +157,6 @@ static int aow_init(struct writer_node *wn, unsigned sample_rate, struct private_aow_data *pawd = para_malloc(sizeof(*pawd)); struct ao_write_args_info *conf = wn->conf; - ao_initialize(); if (conf->driver_given) { ret = -E_AO_BAD_DRIVER; id = ao_driver_id(conf->driver_arg); @@ -455,6 +453,5 @@ void ao_write_init(struct writer *w) dh[num_lines] = NULL; w->help.detailed_help = (const char **)dh; ao_write_cmdline_parser_free(&dummy); - ao_shutdown(); } -- 2.39.5