From: Andre Noll Date: Sun, 9 Mar 2014 14:21:48 +0000 (+0100) Subject: ao_write: Call ao_initialize() only once. X-Git-Tag: v0.5.3~20^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=f4b90d1c56f3dfb5e5214fd076df47202f1c69c6 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. --- 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(); }