# HG changeset patch # User reimar # Date 1194086543 0 # Node ID 148ca265fcb6a91f78aad270cb622b0f367645ae # Parent 12dc34b2e41c6dcde9d2622ca1c8f407a4b183d2 Change parsing to allow host == NULL and sink != NULL diff -r 12dc34b2e41c -r 148ca265fcb6 libao2/ao_pulse.c --- a/libao2/ao_pulse.c Sat Nov 03 10:37:22 2007 +0000 +++ b/libao2/ao_pulse.c Sat Nov 03 10:42:23 2007 +0000 @@ -122,13 +122,15 @@ 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 @@ pa_threaded_mainloop_unlock(mainloop); - free(host); + free(devarg); return 1; unlock_and_fail: @@ -213,7 +215,7 @@ fail: if (context) GENERIC_ERR_MSG(context, "Init failed"); - free(host); + free(devarg); uninit(1); return 0; }