summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Brannon <chris@the-brannons.com>2011-02-13 01:37:28 +0000
committerMax Kellermann <max@duempel.org>2011-02-15 12:16:25 +0100
commit2a1f4539f6115f6d01f33b60adf0118122c7018a (patch)
tree65c7349a200b780f6491c24d813398cffc4ec43b /src
parent03018611f8b9d7ed6d55ee45ccf2b69958c05caf (diff)
Insure proper initialization of stack-allocated struct.
Version 1.0.0 of the libao library added a new field to the ao_sample_format struct. It is a char * named matrix. When an ao_sample_format is allocated on the stack, this field contains garbage. The proper course is to insure that is initialized to NULL. NULL indicates that we do not want any mapping. The struct is now initialized using a static initializer, and this technique is compatible with all known versions of libao.
Diffstat (limited to 'src')
-rw-r--r--src/output/ao_plugin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c
index 12d2b7552..63a43ddf0 100644
--- a/src/output/ao_plugin.c
+++ b/src/output/ao_plugin.c
@@ -25,6 +25,9 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "ao"
+/* An ao_sample_format, with all fields set to zero: */
+static const ao_sample_format OUR_AO_FORMAT_INITIALIZER;
+
static unsigned ao_output_ref;
struct ao_data {
@@ -166,7 +169,7 @@ static bool
ao_output_open(void *data, struct audio_format *audio_format,
GError **error)
{
- ao_sample_format format;
+ ao_sample_format format = OUR_AO_FORMAT_INITIALIZER;
struct ao_data *ad = (struct ao_data *)data;
/* support for 24 bit samples in libao is currently dubious,