summaryrefslogtreecommitdiffstats
path: root/libao2/ao_pulse.c
diff options
context:
space:
mode:
Diffstat (limited to 'libao2/ao_pulse.c')
-rw-r--r--libao2/ao_pulse.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c
index 4e9030c802..ad4a7447bc 100644
--- a/libao2/ao_pulse.c
+++ b/libao2/ao_pulse.c
@@ -122,13 +122,15 @@ static int init(int rate_hz, int channels, int format, int flags) {
struct pa_sample_spec ss;
struct pa_channel_map map;
const struct format_map_s *fmt_map;
+ char *devarg = NULL;
char *host = NULL;
char *sink = NULL;
if (ao_subdevice) {
- host = strdup(ao_subdevice);
- sink = strchr(host, ':');
+ devarg = strdup(ao_subdevice);
+ sink = strchr(devarg, ':');
if (sink) *sink++ = 0;
+ if (devarg[0]) host = devarg;
}
ss.channels = channels;
@@ -202,7 +204,7 @@ static int init(int rate_hz, int channels, int format, int flags) {
pa_threaded_mainloop_unlock(mainloop);
- free(host);
+ free(devarg);
return 1;
unlock_and_fail:
@@ -213,7 +215,7 @@ unlock_and_fail:
fail:
if (context)
GENERIC_ERR_MSG(context, "Init failed");
- free(host);
+ free(devarg);
uninit(1);
return 0;
}