diff options
author | Max Kellermann <max@duempel.org> | 2009-03-16 08:44:49 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-16 08:44:49 +0100 |
commit | 18cb4fa277c97c3d52cc784bb94dc931b1d74f08 (patch) | |
tree | 2f68dacec5eaae3380806d4d87bd920e542c761d /src | |
parent | f35432af5a43e39950a426fe078a7dc17e6e6a4d (diff) | |
download | mpd-18cb4fa277c97c3d52cc784bb94dc931b1d74f08.tar.gz mpd-18cb4fa277c97c3d52cc784bb94dc931b1d74f08.tar.xz mpd-18cb4fa277c97c3d52cc784bb94dc931b1d74f08.zip |
output_all: check param!=NULL before accessing it
When printing the error message, MPD dereferences the NULL pointer to
print an error message if no audio_output section is present.
Diffstat (limited to 'src')
-rw-r--r-- | src/output_all.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/output_all.c b/src/output_all.c index d5c388b3b..bf9202060 100644 --- a/src/output_all.c +++ b/src/output_all.c @@ -113,8 +113,13 @@ audio_output_all_init(void) /* only allow param to be NULL if there just one audioOutput */ assert(param || (num_audio_outputs == 1)); - if (!audio_output_init(output, param, &error)) - g_error("line %i: %s", param->line, error->message); + if (!audio_output_init(output, param, &error)) { + if (param != NULL) + g_error("line %i: %s", + param->line, error->message); + else + g_error("%s", error->message); + } /* require output names to be unique: */ for (j = 0; j < i; j++) { |